Commit dd2699be authored by techird's avatar techird

bug fix: hand and drag

parent 9b8dddbf
Subproject commit a9630e638b29633f62cdc2df239bc702118b231a
Subproject commit 26f9836718affd92c95196be698b14b1c6da4a95
......@@ -261,11 +261,12 @@ KityMinder.registerModule( "DragTree", function () {
this._dragBox.dragStart( e.getPosition() );
}
},
mousemove: function ( e ) {
'mousemove': function ( e ) {
this._dragBox.dragMove( e.getPosition() );
},
mouseup: function ( e ) {
'mouseup': function ( e ) {
this._dragBox.dragEnd();
this.rollbackStatus();
}
},
commands: {
......
......@@ -27,21 +27,27 @@ var ViewDragger = kity.createClass( "ViewDragger", {
lastPosition = null,
currentPosition = null;
this._minder.on( 'hand.beforemousedown', function ( e ) {
// 已经被用户打开拖放模式
if ( dragger.isEnabled() ) {
lastPosition = e.getPosition();
e.stopPropagation();
e.originEvent.preventDefault();
}
this._minder.on( 'normal.beforemousedown', function ( e ) {
// 点击未选中的根节点临时开启
else if ( e.getTargetNode() == this.getRoot() &&
if ( e.getTargetNode() == this.getRoot() &&
( !this.getRoot().isSelected() || !this.isSingleSelect() ) ) {
lastPosition = e.getPosition();
dragger.setEnabled( true );
isRootDrag = true;
var me = this;
setTimeout(function() {
me.setStatus('hand');
}, 1);
}
} );
this._minder.on( 'hand.beforemousedown', function ( e ) {
// 已经被用户打开拖放模式
if ( dragger.isEnabled() ) {
lastPosition = e.getPosition();
e.stopPropagation();
e.originEvent.preventDefault();
}
} )
.on( 'hand.beforemousemove', function ( e ) {
......@@ -63,6 +69,7 @@ var ViewDragger = kity.createClass( "ViewDragger", {
if ( isRootDrag ) {
dragger.setEnabled( false );
isRootDrag = false;
this.rollbackStatus();
}
} );
}
......@@ -77,10 +84,10 @@ KityMinder.registerModule( 'Hand', function () {
execute: function ( minder ) {
minder._viewDragger.setEnabled( !minder._viewDragger.isEnabled() );
if(minder._viewDragger.isEnabled()){
minder.setStatus('hand')
}else{
minder.rollbackStatus()
if ( minder._viewDragger.isEnabled() ) {
minder.setStatus( 'hand' );
} else {
minder.rollbackStatus();
}
},
......@@ -113,9 +120,9 @@ KityMinder.registerModule( 'Hand', function () {
e.originEvent.preventDefault();
},
dblclick: function() {
dblclick: function () {
var viewport = this.getPaper().getViewPort();
var offset = this.getRoot().getRenderContainer(this.getRenderContainer()).getTransform().getTranslate();
var offset = this.getRoot().getRenderContainer( this.getRenderContainer() ).getTransform().getTranslate();
var dx = viewport.center.x - offset.x,
dy = viewport.center.y - offset.y;
//this.getRenderContainer().fxTranslate(dx, dy, 300);
......
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