Commit d17305ff authored by Akikonata's avatar Akikonata

fixed select bug

parent 158f30b6
...@@ -60,37 +60,35 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -60,37 +60,35 @@ KityMinder.registerModule( "KeyboardModule", function () {
buildPositionNetwork( this.getRoot() ); buildPositionNetwork( this.getRoot() );
}, },
keydown: function ( e ) { keydown: function ( e ) {
switch ( e.originEvent.keyCode ) { switch ( e.originEvent.keyCode ) {
case keymap.Enter:
this.execCommand( 'appendSiblingNode', new MinderNode( 'Topic' ) );
e.preventDefault();
break;
case keymap.Tab:
this.execCommand( 'appendChildNode', new MinderNode( 'Topic' ) );
e.preventDefault();
break;
case keymap.Backspace:
case keymap.Del:
this.execCommand( 'removenode' );
e.preventDefault();
break;
case keymap.Enter: case keymap.Left:
this.execCommand( 'appendSiblingNode', new MinderNode( 'Topic' ) ); case keymap.up:
e.preventDefault(); case keymap.Right:
break; case keymap.Down:
case keymap.Tab: if ( this.isSingleSelect() ) {
this.execCommand( 'appendChildNode', new MinderNode( 'Topic' ) ); KBNavigate( this, {
e.preventDefault(); 37: 'left',
break; 38: 'top',
case keymap.Backspace: 39: 'right',
case keymap.Del: 40: 'down'
this.execCommand( 'removenode' ); }[ e.originEvent.keyCode ] );
e.preventDefault(); }
break; e.preventDefault();
break;
case keymap.Left:
case keymap.up:
case keymap.Right:
case keymap.Down:
if ( this.isSingleSelect() ) {
KBNavigate( this, {
37: 'left',
38: 'top',
39: 'right',
40: 'down'
}[ e.originEvent.keyCode ] );
}
e.preventDefault();
break;
} }
} }
......
...@@ -131,11 +131,11 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -131,11 +131,11 @@ KityMinder.registerModule( "LayoutModule", function () {
for ( var i = 0; i < selectedNodes.length; i++ ) { for ( var i = 0; i < selectedNodes.length; i++ ) {
_buffer.push( selectedNodes[ i ] ); _buffer.push( selectedNodes[ i ] );
} }
while ( _buffer.length !== 1 ) { do {
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 );
km.removeNode( selectedNodes ); km.removeNode( selectedNodes );
km.select( _buffer[ 0 ] ); km.select( _buffer[ 0 ] );
} }
...@@ -153,6 +153,9 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -153,6 +153,9 @@ KityMinder.registerModule( "LayoutModule", function () {
"ready": function () { "ready": function () {
this.setDefaultOptions( 'layoutstyle', this.getLayoutStyleItems() ); this.setDefaultOptions( 'layoutstyle', this.getLayoutStyleItems() );
switchLayout( this, this.getOptions( 'defaultlayoutstyle' ) ); switchLayout( this, this.getOptions( 'defaultlayoutstyle' ) );
},
"click": function ( e ) {
} }
}, },
"defaultOptions": { "defaultOptions": {
......
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