Commit 992445b9 authored by Akikonata's avatar Akikonata

test

parent afe603ba
...@@ -176,6 +176,7 @@ KityMinder.registerModule( "LayoutBottom", function () { ...@@ -176,6 +176,7 @@ KityMinder.registerModule( "LayoutBottom", function () {
var nodeType = node.getType(); var nodeType = node.getType();
var Layout = node.getLayout(); var Layout = node.getLayout();
var _root = minder.getRoot(); var _root = minder.getRoot();
var mainnodes = _root.getChildren();
var countMainWidth = function ( node ) { var countMainWidth = function ( node ) {
var nLayout = node.getLayout(); var nLayout = node.getLayout();
var selfwidth = node.getRenderContainer().getWidth() + nodeStyles.main.margin[ 1 ] + nodeStyles.main.margin[ 3 ]; var selfwidth = node.getRenderContainer().getWidth() + nodeStyles.main.margin[ 1 ] + nodeStyles.main.margin[ 3 ];
...@@ -199,7 +200,6 @@ KityMinder.registerModule( "LayoutBottom", function () { ...@@ -199,7 +200,6 @@ KityMinder.registerModule( "LayoutBottom", function () {
effectSet = effectSet.concat( children ); effectSet = effectSet.concat( children );
} else if ( nodeType === "main" ) { } else if ( nodeType === "main" ) {
Layout.align = "center"; Layout.align = "center";
var mainnodes = _root.getChildren();
var rootLayout = _root.getLayout(); var rootLayout = _root.getLayout();
var rootbranchwidth = 0; var rootbranchwidth = 0;
for ( var j = 0; j < mainnodes.length; j++ ) { for ( var j = 0; j < mainnodes.length; j++ ) {
...@@ -243,7 +243,7 @@ KityMinder.registerModule( "LayoutBottom", function () { ...@@ -243,7 +243,7 @@ KityMinder.registerModule( "LayoutBottom", function () {
} }
//自顶向下更新y //自顶向下更新y
var idx = prt.getIndex(); var idx = prt.getIndex();
effectSet = [ node ];
} }
return effectSet; return effectSet;
}; };
......
...@@ -98,9 +98,6 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -98,9 +98,6 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command, base: Command,
execute: function ( km, node ) { execute: function ( km, node ) {
var parent = km.getSelectedNode(); var parent = km.getSelectedNode();
if ( !parent ) {
return false;
}
km.appendChildNode( parent, node ); km.appendChildNode( parent, node );
km.select( node, true ); km.select( node, true );
return node; return node;
...@@ -120,9 +117,6 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -120,9 +117,6 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command, base: Command,
execute: function ( km, node ) { execute: function ( km, node ) {
var selectedNode = km.getSelectedNode(); var selectedNode = km.getSelectedNode();
if ( !selectedNode ) {
return false;
}
if ( selectedNode.isRoot() ) { if ( selectedNode.isRoot() ) {
node.setType( "main" ); node.setType( "main" );
km.appendChildNode( selectedNode, node ); km.appendChildNode( selectedNode, node );
...@@ -134,8 +128,9 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -134,8 +128,9 @@ KityMinder.registerModule( "LayoutModule", function () {
return node; return node;
}, },
queryState: function ( km ) { queryState: function ( km ) {
var selectedNode = km.getSelectedNode(); var selectedNodes = km.getSelectedNodes();
if ( !selectedNode || selectedNode === km.getRoot() ) { //没选中节点和单选root的时候返回不可执行
if ( selectedNodes.length === 0 || ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) ) {
return -1; return -1;
} else { } else {
return 0; return 0;
...@@ -149,10 +144,6 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -149,10 +144,6 @@ KityMinder.registerModule( "LayoutModule", function () {
execute: function ( km ) { execute: function ( km ) {
var selectedNodes = km.getSelectedNodes(); var selectedNodes = km.getSelectedNodes();
var _root = km.getRoot(); var _root = km.getRoot();
if ( selectedNodes.length === 0 || ( selectedNodes.length === 1 && !selectedNodes[ 0 ].getParent() ) ) {
km.select( _root );
return false;
}
var _buffer = []; var _buffer = [];
for ( var i = 0; i < selectedNodes.length; i++ ) { for ( var i = 0; i < selectedNodes.length; i++ ) {
_buffer.push( selectedNodes[ i ] ); _buffer.push( selectedNodes[ i ] );
...@@ -167,7 +158,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -167,7 +158,7 @@ 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 === 0 || ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) ) {
return -1; return -1;
} else { } else {
return 0; return 0;
...@@ -205,7 +196,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -205,7 +196,7 @@ KityMinder.registerModule( "LayoutModule", function () {
} }
}, },
"defaultOptions": { "defaultOptions": {
"defaultlayoutstyle": "default", "defaultlayoutstyle": "bottom",
"node": { "node": {
'appendsiblingnode': 'appendsiblingnode', 'appendsiblingnode': 'appendsiblingnode',
'appendchildnode': 'appendchildnode', 'appendchildnode': 'appendchildnode',
......
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