Commit 3727100e authored by techird's avatar techird

双击视野回到根节点

parent 9a7104c0
Subproject commit 26f9836718affd92c95196be698b14b1c6da4a95 Subproject commit e144ccd9270712497804915d13ec92f6593299b0
...@@ -35,9 +35,9 @@ var ViewDragger = kity.createClass( "ViewDragger", { ...@@ -35,9 +35,9 @@ var ViewDragger = kity.createClass( "ViewDragger", {
dragger.setEnabled( true ); dragger.setEnabled( true );
isRootDrag = true; isRootDrag = true;
var me = this; var me = this;
setTimeout(function() { setTimeout( function () {
me.setStatus('hand'); me.setStatus( 'hand' );
}, 1); }, 1 );
} }
} ); } );
...@@ -111,21 +111,36 @@ KityMinder.registerModule( 'Hand', function () { ...@@ -111,21 +111,36 @@ KityMinder.registerModule( 'Hand', function () {
} }
}, },
mousewheel: function ( e ) { mousewheel: function ( e ) {
var dx = e.originEvent.wheelDeltaX || 0, var dx, dy;
dy = e.originEvent.wheelDeltaY || e.originEvent.wheelDelta; e = e.originEvent;
if ( 'wheelDeltaX' in e ) {
dx = e.wheelDeltaX || 0;
dy = e.wheelDeltaY || 0;
} else {
dx = 0;
dy = e.wheelDelta;
}
this._viewDragger.move( { this._viewDragger.move( {
x: dx / 2.5, x: dx / 2.5,
y: dy / 2.5 y: dy / 2.5
} ); } );
e.originEvent.preventDefault(); e.preventDefault();
}, },
dblclick: function () { dblclick: function ( e ) {
if ( e.getTargetNode() ) return;
var viewport = this.getPaper().getViewPort(); var viewport = this.getPaper().getViewPort();
var offset = this.getRoot().getRenderContainer( this.getRenderContainer() ).getTransform().getTranslate(); var offset = this.getRoot().getRenderContainer().getRenderBox( this.getRenderContainer() );
var dx = viewport.center.x - offset.x, var dx = viewport.center.x - offset.x - offset.width / 2,
dy = viewport.center.y - offset.y; dy = viewport.center.y - offset.y;
//this.getRenderContainer().fxTranslate(dx, dy, 300); this.getRenderContainer().fxTranslate( dx, dy, 1000, "easeOutQuint" );
} }
} }
}; };
......
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