Commit 290f1339 authored by Akikonata's avatar Akikonata

fixed layout bug

parent 39b21a35
...@@ -31,20 +31,20 @@ kity.extendClass( Minder, function () { ...@@ -31,20 +31,20 @@ kity.extendClass( Minder, function () {
} ); } );
this._selectedNodes = []; this._selectedNodes = [];
}, },
removeSelectedNodes:function(nodes){ removeSelectedNodes: function ( nodes ) {
var me = this; var me = this;
Utils.each( Utils.isArray( nodes ) ? nodes : [ nodes ], function ( i, n ) { Utils.each( Utils.isArray( nodes ) ? nodes : [ nodes ], function ( i, n ) {
if ( me._selectedNodes.indexOf( n ) === -1 )return; if ( me._selectedNodes.indexOf( n ) === -1 ) return;
me._selectedNodes.splice(i,1); me._selectedNodes.splice( i, 1 );
unhighlightNode( me, n ); unhighlightNode( me, n );
} ); } );
return this; return this;
}, },
select: function ( nodes,isToggleSelect ) { select: function ( nodes, isToggleSelect ) {
isToggleSelect && this.removeAllSelectedNodes(); isToggleSelect && this.removeAllSelectedNodes();
var me = this; var me = this;
Utils.each( Utils.isArray( nodes ) ? nodes : [ nodes ], function ( i, n ) { Utils.each( Utils.isArray( nodes ) ? nodes : [ nodes ], function ( i, n ) {
if ( me._selectedNodes.indexOf( n ) !== -1 )return; if ( me._selectedNodes.indexOf( n ) !== -1 ) return;
me._selectedNodes.push( n ); me._selectedNodes.push( n );
highlightNode( me, n ); highlightNode( me, n );
} ); } );
......
...@@ -409,7 +409,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -409,7 +409,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( _buffer.length !== 0 ) { if ( _buffer.length !== 0 ) {
for ( var i = 0; i < _buffer.length; i++ ) { for ( var i = 0; i < _buffer.length; i++ ) {
var point = _buffer[ i ].getPoint(); var point = _buffer[ i ].getPoint();
if ( point ) { if ( point && point.x && point.y ) {
if ( point.x > Layout.x ) { if ( point.x > Layout.x ) {
Layout.rightList.push( _buffer[ i ] ); Layout.rightList.push( _buffer[ i ] );
} else { } else {
......
...@@ -85,7 +85,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -85,7 +85,7 @@ KityMinder.registerModule( "LayoutModule", function () {
execute: function ( km, node ) { execute: function ( km, node ) {
var parent = km.getSelectedNode(); var parent = km.getSelectedNode();
km.appendChildNode( parent, node ); km.appendChildNode( parent, node );
km.select( node,true ); km.select( node, true );
return node; return node;
} }
}; };
...@@ -100,7 +100,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -100,7 +100,7 @@ KityMinder.registerModule( "LayoutModule", function () {
} else { } else {
km.appendSiblingNode( selectedNode, node ); km.appendSiblingNode( selectedNode, node );
} }
km.select( node,true ); km.select( node, true );
return node; return node;
} }
}; };
......
...@@ -76,7 +76,7 @@ KityMinder.registerModule( "MouseModule", function () { ...@@ -76,7 +76,7 @@ KityMinder.registerModule( "MouseModule", function () {
if ( e.originEvent.touches && e.originEvent.touches.length != 1 ) return; if ( e.originEvent.touches && e.originEvent.touches.length != 1 ) return;
var clickNode = e.getTargetNode(); var clickNode = e.getTargetNode();
if ( clickNode ) { if ( clickNode ) {
this.select( clickNode ); this.select( clickNode, true );
} else { } else {
this.removeAllSelectedNodes(); this.removeAllSelectedNodes();
this.SelectArea.selectStart( e ); this.SelectArea.selectStart( e );
......
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