From 0bc7a0107fc0152a56fcb9c29c6704f95b6080d9 Mon Sep 17 00:00:00 2001 From: Yueyu Date: Sat, 10 Jul 2021 07:51:07 +0800 Subject: [PATCH] add some thresholds for stage outside --- src/editor/engine/Stage.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/editor/engine/Stage.js b/src/editor/engine/Stage.js index ced5638..b7b0f0c 100644 --- a/src/editor/engine/Stage.js +++ b/src/editor/engine/Stage.js @@ -474,8 +474,16 @@ export default class Stage { var pt = this.getStagePt(e); // if pointer is outside stage // cancel the dragging event - if (pt.x < 0 || pt.x > this.width || pt.y < 0 || pt.y > this.height) { + var threshold = 15; + if ( + pt.x < -threshold + || pt.y < -threshold + || pt.x > (this.width + threshold) + || pt.y > (this.height + threshold) + ) { + Events.clearEvents(); Events.dragged = false; + Events.dragthumbnail = undefined; return; } var delta = Vector.diff(pt, this.initialPoint);