Commit 43b2e5c6 authored by 张博's avatar 张博

解决了拖拽跳动的问题

parent c7c9459b
...@@ -91,6 +91,7 @@ define(function(require, exports, module) { ...@@ -91,6 +91,7 @@ define(function(require, exports, module) {
function dragEnd(e) { function dragEnd(e) {
if (!lastPosition) return; if (!lastPosition) return;
lastPosition = null; lastPosition = null;
e.stopPropagation(); e.stopPropagation();
...@@ -342,33 +343,29 @@ define(function(require, exports, module) { ...@@ -342,33 +343,29 @@ define(function(require, exports, module) {
if (kity.Browser.edge) { if (kity.Browser.edge) {
this.fire('paperrender'); this.fire('paperrender');
} }
if (!selected) return; if (!selected) return;
var dragger = this._viewDragger; var dragger = this._viewDragger;
var view = dragger.getView(); var view = dragger.getView();
var focus = selected.getLayoutBox(); var focus = selected.getLayoutBox();
var space = 150; var space = 50;
var tolerance = 150; var dx = 0, dy = 0;
var dx = 0,
dy = 0;
if (focus.right > view.right - tolerance) { if (focus.right > view.right) {
dx += view.right - focus.right - space; dx += view.right - focus.right - space;
} else if (focus.left < view.left + tolerance) { }
else if (focus.left < view.left) {
dx += view.left - focus.left + space; dx += view.left - focus.left + space;
} }
if (focus.bottom > view.bottom - tolerance) { if (focus.bottom > view.bottom) {
dy += view.bottom - focus.bottom - space; dy += view.bottom - focus.bottom - space;
} }
if (focus.top < view.top + tolerance) { if (focus.top < view.top) {
dy += view.top - focus.top + space; dy += view.top - focus.top + space;
} }
if (dx || dy) { if (dx || dy) dragger.move(new kity.Point(dx, dy), 100);
dragger.move(new kity.Point(dx, dy));
}
} }
......
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