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

解决了拖拽跳动的问题

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