Commit fc1feab1 authored by techird's avatar techird

实验拖动功能

parent 7eeea30b
...@@ -105,6 +105,7 @@ kity.extendClass(MinderNode, { ...@@ -105,6 +105,7 @@ kity.extendClass(MinderNode, {
x: p.x, x: p.x,
y: p.y y: p.y
}); });
return this;
}, },
getLayoutRoot: function() { getLayoutRoot: function() {
...@@ -130,6 +131,10 @@ kity.extendClass(MinderNode, { ...@@ -130,6 +131,10 @@ kity.extendClass(MinderNode, {
this.getMinder().layout(duration); this.getMinder().layout(duration);
return this; return this;
},
getPositionContext: function(node, position) {
} }
}); });
...@@ -167,6 +172,9 @@ kity.extendClass(Minder, { ...@@ -167,6 +172,9 @@ kity.extendClass(Minder, {
var matrix = node.getLayoutTransform().merge(pMatrix); var matrix = node.getLayoutTransform().merge(pMatrix);
var lastMatrix = node._lastLayoutTransform || new kity.Matrix(); var lastMatrix = node._lastLayoutTransform || new kity.Matrix();
var offset = node.getLayoutOffset();
matrix.translate(offset.x, offset.y);
if (!matrix.equals(lastMatrix) || true) { if (!matrix.equals(lastMatrix) || true) {
// 如果当前有动画,停止动画 // 如果当前有动画,停止动画
......
...@@ -158,7 +158,7 @@ KityMinder.registerConnectProvider('default', function(node, parent, connection) ...@@ -158,7 +158,7 @@ KityMinder.registerConnectProvider('default', function(node, parent, connection)
end = new kity.Point(box.left - node.getStyle('margin-left'), box.bottom); end = new kity.Point(box.left - node.getStyle('margin-left'), box.bottom);
} }
end.y += 1; end.y += 3;
var isTop = parent.children.length > 1 && node.getIndex() === 0; var isTop = parent.children.length > 1 && node.getIndex() === 0;
......
...@@ -234,11 +234,11 @@ var DragBox = kity.createClass('DragBox', { ...@@ -234,11 +234,11 @@ var DragBox = kity.createClass('DragBox', {
} }
var movement = kity.Vector.fromPoints(this._startPosition, this._dragPosition); var movement = kity.Vector.fromPoints(this._startPosition, this._dragPosition);
// var minder = this._minder; var minder = this._minder;
// this._dragSources.forEach(function(source) { this._dragSources.forEach(function(source) {
// source.setLayoutOffset(movement); source.setLayoutOffset(movement);
// minder.layout(); minder.layout();
// }); });
this.setTranslate(movement); this.setTranslate(movement);
......
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