Commit 4c0db9f7 authored by Akikonata's avatar Akikonata

fixed bug

parent ddd06b24
......@@ -182,6 +182,9 @@ KityMinder.registerModule( "LayoutBottom", function () {
var childwidth = Layout.subgroup.getWidth() + nodeStyles.sub.margin[ 3 ];
var branchwidth = nLayout.branchwidth = ( selfwidth > childwidth ? selfwidth : childwidth );
return branchwidth;
};
var updateMain = function ( node ) {
};
if ( nodeType === "root" ) {
Layout.x = getMinderSize().width / 2;
......@@ -216,13 +219,30 @@ KityMinder.registerModule( "LayoutBottom", function () {
} else {
Layout.align = "left";
var parentLayout = parent.getLayout();
if ( action === "append" ) {
if ( parent.getType() === "main" ) {
Layout.x = 10;
Layout.y = nodeStyles.sub.margin[ 0 ];
} else {
Layout.x = parentLayout.x + 10;
Layout.y = parentLayout.y + parent.getRenderContainer().getHeight() + nodeStyles.sub.margin[ 0 ];
}
}
if ( action === "append" || action === "change" ) {
Layout.branchheight = node.getRenderContainer().getHeight() + nodeStyles.sub.margin[ 0 ] + nodeStyles.sub.margin[ 2 ];
}
var prt = parent;
//自底向上更新branchheight
while ( prt.getType() !== "main" ) {
var c = prt.getChildren();
var prtLayout = prt.getLayout();
var branchHeight = prt.getRenderContainer().getHeight() + nodeStyles.sub.margin[ 0 ] + nodeStyles.sub.margin[ 2 ];
for ( var i1 = 0; i1 < c.length; i1++ ) {
branchHeight += c[ i1 ].getLayout().branchheight;
}
prtLayout.branchheight = branchHeight;
prt = prt.getParent();
}
//自顶向下更新y
var idx = prt.getIndex();
effectSet = [ node ];
}
return effectSet;
......
......@@ -605,7 +605,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
var parent = _buffer[ 0 ].getParent();
Layout.parent = parent;
_cleanbuffer.push( _buffer[ 0 ] );
//minder.appendChildNode( parent, _buffer[ 0 ] );
Layout.connect = null;
Layout.shicon = null;
} else {
......
......@@ -108,9 +108,9 @@ KityMinder.registerModule( "LayoutModule", function () {
queryState: function ( km ) {
var selectedNode = km.getSelectedNode();
if ( !selectedNode ) {
return false;
return -1;
} else {
return true;
return 0;
}
}
};
......@@ -136,9 +136,9 @@ KityMinder.registerModule( "LayoutModule", function () {
queryState: function ( km ) {
var selectedNode = km.getSelectedNode();
if ( !selectedNode || selectedNode === km.getRoot() ) {
return false;
return -1;
} else {
return true;
return 0;
}
}
};
......@@ -168,9 +168,9 @@ KityMinder.registerModule( "LayoutModule", function () {
queryState: function ( km ) {
var selectedNodes = km.getSelectedNodes();
if ( ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) || selectedNodes.length === 0 ) {
return false;
return -1;
} else {
return true;
return 0;
}
}
};
......@@ -205,11 +205,11 @@ KityMinder.registerModule( "LayoutModule", function () {
}
},
"defaultOptions": {
"defaultlayoutstyle": "default",
"node":{
'appendsiblingnode':'appendsiblingnode',
'appendchildnode':'appendchildnode',
'removenode':'removenode'
"defaultlayoutstyle": "bottom",
"node": {
'appendsiblingnode': 'appendsiblingnode',
'appendchildnode': 'appendchildnode',
'removenode': 'removenode'
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment