Commit e7bca98e authored by techird's avatar techird

drop target effect

parent ce6d6e6c
...@@ -72,7 +72,7 @@ kity.extendClass( Minder, { ...@@ -72,7 +72,7 @@ kity.extendClass( Minder, {
if ( test.recognize && test.recognize( local ) ) { if ( test.recognize && test.recognize( local ) ) {
protocal = test; protocal = test;
} }
return !test; return !protocal;
} ); } );
} }
......
...@@ -105,6 +105,14 @@ function findAvailableParents( nodes, root ) { ...@@ -105,6 +105,14 @@ function findAvailableParents( nodes, root ) {
return availables; return availables;
} }
var lastActivedDropTarget = null;
function activeDropTarget( node ) {
if(lastActivedDropTarget != node) {
node.getRenderContainer().fxScale(1.6, 1.6, 200, 'ease').fxScale(1/1.6, 1/1.6, 300, 'ease');
lastActivedDropTarget = node;
}
}
KityMinder.registerModule( "DragTree", function () { KityMinder.registerModule( "DragTree", function () {
var dragStartPosition, dragBox, dragTargets, dropTargets, dragTargetBoxes, dropTarget; var dragStartPosition, dragBox, dragTargets, dropTargets, dragTargetBoxes, dropTarget;
...@@ -147,13 +155,18 @@ KityMinder.registerModule( "DragTree", function () { ...@@ -147,13 +155,18 @@ KityMinder.registerModule( "DragTree", function () {
dragBox.blue(); dragBox.blue();
dropTarget = null; dropTarget = null;
} }
dropTargets.forEach( function ( test ) { dropTargets.forEach( function ( test ) {
if ( GM.isBoxIntersect( dragBox.getRenderBox(), test.getRenderContainer().getRenderBox() ) ) { if ( !dropTarget && GM.isBoxIntersect( dragBox.getRenderBox(), test.getRenderContainer().getRenderBox() ) ) {
activeDropTarget(test);
//test.getRenderContainer().scale( 1.25 ); //test.getRenderContainer().scale( 1.25 );
dropTarget = test; dropTarget = test;
dragBox.green(); dragBox.green();
} }
} ); } );
if( !dropTarget ) {
lastActivedDropTarget = null;
}
}, },
mouseup: function ( e ) { mouseup: function ( e ) {
dragStartPosition = null; dragStartPosition = null;
...@@ -161,12 +174,13 @@ KityMinder.registerModule( "DragTree", function () { ...@@ -161,12 +174,13 @@ KityMinder.registerModule( "DragTree", function () {
dragBox.remove(); dragBox.remove();
dragBox = null; dragBox = null;
if ( dropTarget ) { if ( dropTarget ) {
dragTargets.forEach( function ( target ) { for(var i = dragTargets.length - 1, target; i >= 0; i--) {
target = dragTargets[i];
if ( target.parent ) { if ( target.parent ) {
target.parent.removeChild( target ); target.parent.removeChild( target );
dropTarget.appendChild( target ); dropTarget.appendChild( target );
} }
} ); }
this.removeAllSelectedNodes(); this.removeAllSelectedNodes();
this.initStyle( this.getRoot() ); this.initStyle( this.getRoot() );
} }
......
...@@ -73,6 +73,7 @@ KityMinder.registerModule( "Select", function () { ...@@ -73,6 +73,7 @@ KityMinder.registerModule( "Select", function () {
}; };
} )(); } )();
var singleSelectOnUp = null;
return { return {
"events": { "events": {
mousedown: function ( e ) { mousedown: function ( e ) {
...@@ -84,13 +85,16 @@ KityMinder.registerModule( "Select", function () { ...@@ -84,13 +85,16 @@ KityMinder.registerModule( "Select", function () {
this.toggleSelect( clickNode ); this.toggleSelect( clickNode );
} else if ( !clickNode.isSelected() ) { } else if ( !clickNode.isSelected() ) {
this.select( clickNode, true ); this.select( clickNode, true );
} else if ( !this.isSingleSelect() ) {
singleSelectOnUp = clickNode;
} }
}, },
mousemove: marqueeActivator.selectMove, mousemove: marqueeActivator.selectMove,
mouseup: function ( e ) { mouseup: function ( e ) {
var clickNode = e.getTargetNode(); var clickNode = e.getTargetNode();
if ( clickNode && clickNode.isSelected() && !this.isSingleSelect() ) { if ( clickNode && singleSelectOnUp == clickNode ) {
this.select( clickNode, true ); this.select( singleSelectOnUp, true );
singleSelectOnUp = null;
} }
marqueeActivator.selectEnd( e ); marqueeActivator.selectEnd( 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