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:
Jonathan Puckey 2011-05-14 12:59:21 +02:00
parent 032d19b0d2
commit 35d51085a1

View file

@ -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();
},