mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -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,
|
||||
// prevent the default behaviour, as it will otherwise
|
||||
// scroll the page:
|
||||
if (event && event.targetTouches)
|
||||
var touchDevice = event && event.targetTouches;
|
||||
if (touchDevice)
|
||||
event.preventDefault();
|
||||
var point = event && viewToArtwork(event, that._document);
|
||||
// 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) {
|
||||
that.onHandleEvent('mousemove', point, event);
|
||||
}
|
||||
if (that.onMouseMove || that.onMouseDrag)
|
||||
if (that.onMouseMove || (touchDevice && that.onMouseDrag))
|
||||
that._document.redraw();
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue