add some thresholds for stage outside

This commit is contained in:
Yueyu 2021-07-10 07:51:07 +08:00
parent 5fc7775748
commit 0bc7a0107f

View file

@ -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);