Commit 4c0db9f7 authored by Akikonata's avatar Akikonata

fixed bug

parent ddd06b24
...@@ -182,6 +182,9 @@ KityMinder.registerModule( "LayoutBottom", function () { ...@@ -182,6 +182,9 @@ KityMinder.registerModule( "LayoutBottom", function () {
var childwidth = Layout.subgroup.getWidth() + nodeStyles.sub.margin[ 3 ]; var childwidth = Layout.subgroup.getWidth() + nodeStyles.sub.margin[ 3 ];
var branchwidth = nLayout.branchwidth = ( selfwidth > childwidth ? selfwidth : childwidth ); var branchwidth = nLayout.branchwidth = ( selfwidth > childwidth ? selfwidth : childwidth );
return branchwidth; return branchwidth;
};
var updateMain = function ( node ) {
}; };
if ( nodeType === "root" ) { if ( nodeType === "root" ) {
Layout.x = getMinderSize().width / 2; Layout.x = getMinderSize().width / 2;
...@@ -216,13 +219,30 @@ KityMinder.registerModule( "LayoutBottom", function () { ...@@ -216,13 +219,30 @@ KityMinder.registerModule( "LayoutBottom", function () {
} else { } else {
Layout.align = "left"; Layout.align = "left";
var parentLayout = parent.getLayout(); var parentLayout = parent.getLayout();
if ( parent.getType() === "main" ) { if ( action === "append" ) {
Layout.x = 10; if ( parent.getType() === "main" ) {
Layout.y = nodeStyles.sub.margin[ 0 ]; Layout.x = 10;
} else { } else {
Layout.x = parentLayout.x + 10; 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 ]; effectSet = [ node ];
} }
return effectSet; return effectSet;
......
...@@ -605,7 +605,6 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -605,7 +605,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
var parent = _buffer[ 0 ].getParent(); var parent = _buffer[ 0 ].getParent();
Layout.parent = parent; Layout.parent = parent;
_cleanbuffer.push( _buffer[ 0 ] ); _cleanbuffer.push( _buffer[ 0 ] );
//minder.appendChildNode( parent, _buffer[ 0 ] );
Layout.connect = null; Layout.connect = null;
Layout.shicon = null; Layout.shicon = null;
} else { } else {
......
...@@ -108,9 +108,9 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -108,9 +108,9 @@ KityMinder.registerModule( "LayoutModule", function () {
queryState: function ( km ) { queryState: function ( km ) {
var selectedNode = km.getSelectedNode(); var selectedNode = km.getSelectedNode();
if ( !selectedNode ) { if ( !selectedNode ) {
return false; return -1;
} else { } else {
return true; return 0;
} }
} }
}; };
...@@ -136,9 +136,9 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -136,9 +136,9 @@ KityMinder.registerModule( "LayoutModule", function () {
queryState: function ( km ) { queryState: function ( km ) {
var selectedNode = km.getSelectedNode(); var selectedNode = km.getSelectedNode();
if ( !selectedNode || selectedNode === km.getRoot() ) { if ( !selectedNode || selectedNode === km.getRoot() ) {
return false; return -1;
} else { } else {
return true; return 0;
} }
} }
}; };
...@@ -168,9 +168,9 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -168,9 +168,9 @@ KityMinder.registerModule( "LayoutModule", function () {
queryState: function ( km ) { queryState: function ( km ) {
var selectedNodes = km.getSelectedNodes(); var selectedNodes = km.getSelectedNodes();
if ( ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) || selectedNodes.length === 0 ) { if ( ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) || selectedNodes.length === 0 ) {
return false; return -1;
} else { } else {
return true; return 0;
} }
} }
}; };
...@@ -205,12 +205,12 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -205,12 +205,12 @@ KityMinder.registerModule( "LayoutModule", function () {
} }
}, },
"defaultOptions": { "defaultOptions": {
"defaultlayoutstyle": "default", "defaultlayoutstyle": "bottom",
"node":{ "node": {
'appendsiblingnode':'appendsiblingnode', 'appendsiblingnode': 'appendsiblingnode',
'appendchildnode':'appendchildnode', 'appendchildnode': 'appendchildnode',
'removenode':'removenode' 'removenode': 'removenode'
} }
} }
}; };
} ); } );
\ No newline at end of file
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