Commit 8ac4e2ef authored by Akikonata's avatar Akikonata

fixed bug

parent 003f8207
...@@ -543,6 +543,10 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -543,6 +543,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
removeNode: function ( nodes ) { removeNode: function ( nodes ) {
while ( nodes.length !== 0 ) { while ( nodes.length !== 0 ) {
var parent = nodes[ 0 ].getParent(); var parent = nodes[ 0 ].getParent();
if ( !parent ) {
nodes.splice( 0, 1 );
return false;
}
var nodeLayout = nodes[ 0 ].getLayout(); var nodeLayout = nodes[ 0 ].getLayout();
if ( parent.getType() === "root" ) { if ( parent.getType() === "root" ) {
var sideList = parent.getLayout()[ nodeLayout.appendside + "List" ]; var sideList = parent.getLayout()[ nodeLayout.appendside + "List" ];
......
...@@ -132,6 +132,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -132,6 +132,7 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command, base: Command,
execute: function ( km ) { execute: function ( km ) {
var selectedNodes = km.getSelectedNodes(); var selectedNodes = km.getSelectedNodes();
if ( selectedNodes.length === 0 ) 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 ] );
...@@ -140,7 +141,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -140,7 +141,7 @@ KityMinder.registerModule( "LayoutModule", function () {
var parent = _buffer[ 0 ].getParent(); var parent = _buffer[ 0 ].getParent();
if ( parent && _buffer.indexOf( parent ) === -1 ) _buffer.push( parent ); if ( parent && _buffer.indexOf( parent ) === -1 ) _buffer.push( parent );
_buffer.shift(); _buffer.shift();
} while ( _buffer.length !== 1 ); } while ( _buffer.length > 1 );
km.removeNode( selectedNodes ); km.removeNode( selectedNodes );
km.select( _buffer[ 0 ] ); km.select( _buffer[ 0 ] );
} }
......
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