mirror of
https://github.com/scratchfoundation/scratchjr.git
synced 2024-11-28 18:15:37 -05:00
cancel the dragging event if the pointer is outside stage
This commit is contained in:
parent
a7d7cb1763
commit
5fc7775748
1 changed files with 6 additions and 0 deletions
|
@ -472,6 +472,12 @@ export default class Stage {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var pt = this.getStagePt(e);
|
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) {
|
||||||
|
Events.dragged = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
var delta = Vector.diff(pt, this.initialPoint);
|
var delta = Vector.diff(pt, this.initialPoint);
|
||||||
var dist = ScratchJr.inFullscreen ? 15 : 5;
|
var dist = ScratchJr.inFullscreen ? 15 : 5;
|
||||||
if (!Events.dragged && (Vector.len(delta) > dist)) {
|
if (!Events.dragged && (Vector.len(delta) > dist)) {
|
||||||
|
|
Loading…
Reference in a new issue