Commit 342bbdc9 authored by techird's avatar techird

bugfix

parent cc6e3076
Subproject commit 48128c2e87fb9c8f2f93e64fc2df3f04ffa0a692
Subproject commit ebccc80ba41995fa718b1fb0b8f7d79938501ed1
......@@ -180,7 +180,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
node.parent.removeChild( node );
}
node.parent = this;
node.root = parent.root;
node.root = node.parent.root;
this.children.splice( index, 0, node );
},
......
......@@ -17,6 +17,9 @@ var ViewDragger = kity.createClass( "ViewDragger", {
paper.setStyle( 'cursor', value ? '-webkit-grab' : 'default' );
this._enabled = value;
},
move: function ( offset ) {
this._minder.getRenderContainer().translate( offset.x, offset.y );
},
_bind: function () {
var dragger = this,
......@@ -33,7 +36,7 @@ var ViewDragger = kity.createClass( "ViewDragger", {
}
// 点击未选中的根节点临时开启
else if ( e.getTargetNode() == this.getRoot() &&
(!this.getRoot().isSelected() || !this.isSingleSelect())) {
( !this.getRoot().isSelected() || !this.isSingleSelect() ) ) {
lastPosition = e.getPosition();
dragger.setEnabled( true );
isRootDrag = true;
......@@ -47,8 +50,7 @@ var ViewDragger = kity.createClass( "ViewDragger", {
// 当前偏移加上历史偏移
var offset = kity.Vector.fromPoints( lastPosition, currentPosition );
this.getRenderContainer().translate( offset.x, offset.y );
dragger.move( offset );
e.stopPropagation();
lastPosition = currentPosition;
}
......@@ -90,6 +92,23 @@ KityMinder.registerModule( 'Hand', function () {
this.execCommand( 'hand' );
e.preventDefault();
}
},
mousewheel: function ( e ) {
var dx = e.originEvent.wheelDeltaX || e.originEvent.wheelDelta,
dy = e.originEvent.wheelDeltaY || 0;
this._viewDragger.move( {
x: dx / 2.5,
y: dy / 2.5
} );
e.originEvent.preventDefault();
},
dblclick: function() {
var viewport = this.getPaper().getViewPort();
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