mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-23 07:49:48 -05:00
Tool: fix problem where document was being redrawn onMouseMove with only an onMouseDrag handler (should only happen on touch devices)
This commit is contained in:
parent
032d19b0d2
commit
35d51085a1
1 changed files with 3 additions and 2 deletions
|
@ -45,7 +45,8 @@ var Tool = this.Tool = ToolHandler.extend(new function() {
|
||||||
// If the event was triggered by a touch screen device,
|
// If the event was triggered by a touch screen device,
|
||||||
// prevent the default behaviour, as it will otherwise
|
// prevent the default behaviour, as it will otherwise
|
||||||
// scroll the page:
|
// scroll the page:
|
||||||
if (event && event.targetTouches)
|
var touchDevice = event && event.targetTouches;
|
||||||
|
if (touchDevice)
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var point = event && viewToArtwork(event, that._document);
|
var point = event && viewToArtwork(event, that._document);
|
||||||
// If there is only an onMouseMove handler, call it when
|
// If there is only an onMouseMove handler, call it when
|
||||||
|
@ -58,7 +59,7 @@ var Tool = this.Tool = ToolHandler.extend(new function() {
|
||||||
} else if (!dragging || onlyMove) {
|
} else if (!dragging || onlyMove) {
|
||||||
that.onHandleEvent('mousemove', point, event);
|
that.onHandleEvent('mousemove', point, event);
|
||||||
}
|
}
|
||||||
if (that.onMouseMove || that.onMouseDrag)
|
if (that.onMouseMove || (touchDevice && that.onMouseDrag))
|
||||||
that._document.redraw();
|
that._document.redraw();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue