Commit 56423a1f authored by techird's avatar techird

dev

parent 6ea9d9cc
...@@ -23,7 +23,7 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -23,7 +23,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
function findClosestPointsFor( pointIndexes, iFind ) { function findClosestPointsFor( pointIndexes, iFind ) {
var find = pointIndexes[ iFind ]; var find = pointIndexes[ iFind ];
var matrix = new kity.Matrix().translate( -find.x, -find.y ).rotate( -45 ); var matrix = new kity.Matrix().translate( -find.x, -find.y ).rotate( 45 );
var most = {}, quad; var most = {}, quad;
var current; var current;
...@@ -31,7 +31,7 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -31,7 +31,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
if ( i == iFind ) continue; if ( i == iFind ) continue;
current = matrix.transformPoint( pointIndexes[ i ].x, pointIndexes[ i ].y ); current = matrix.transformPoint( pointIndexes[ i ].x, pointIndexes[ i ].y );
quad = quadOf( current ); quad = quadOf( current );
if ( !most[ quad ] || current.length() < most[ quad ].point.length ) { if ( !most[ quad ] || current.length() < most[ quad ].point.length() ) {
most[ quad ] = { most[ quad ] = {
point: current, point: current,
node: pointIndexes[ i ].node node: pointIndexes[ i ].node
...@@ -67,6 +67,7 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -67,6 +67,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
km.toggleSelect( [ referNode, nextNode ] ); km.toggleSelect( [ referNode, nextNode ] );
km.execCommand( 'rendernode', [ referNode, nextNode ] ); km.execCommand( 'rendernode', [ referNode, nextNode ] );
} }
this.setContentChanged( false );
} }
} ); } );
...@@ -78,6 +79,7 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -78,6 +79,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
}, },
"events": { "events": {
contentchange: function () { contentchange: function () {
console.log( 'rebuild position network' );
buildPositionNetwork( this.getRoot() ); buildPositionNetwork( this.getRoot() );
}, },
keydown: function ( e ) { keydown: function ( e ) {
......
KityMinder.registerModule( "MouseModule", function () { KityMinder.registerModule( "MouseModule", function () {
var SingleSelectCommand = kity.createClass( 'SingleSelectCommand', {
base: Command,
execute: function ( km, node ) {
var deltaNodes = km.getSelectedNodes();
km.clearSelect();
if ( node ) {
km.selectSingle( node );
deltaNodes.push( node );
}
km.execCommand( 'rendernode', deltaNodes );
this.setContentChanged( false );
}
} );
return { return {
"commands": {
'selectsingle': SingleSelectCommand
},
"events": { "events": {
mousedown: function ( e ) { mousedown: function ( e ) {
var clickNode = e.getTargetNode(); var clickNode = e.getTargetNode();
var deltaNodes = this.getSelectedNodes(); this.execCommand( 'selectsingle', clickNode );
this.clearSelect();
if ( clickNode ) {
this.selectSingle( clickNode );
deltaNodes.push( clickNode );
}
this.execCommand( 'rendernode', deltaNodes );
} }
} }
}; };
......
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