This construct lets users draw on a html5 canvas. On other browsers such as mobile Safari and Chrome, .preventDefault()
and .stopPropagation()
successfully cancel any scrolling while moving the finger over the canvas. However mobile IE still scrolls, making it impossible to draw.
Is there any way to cancel scrolling?
startDrawing: function(e) {
var me = this;
if (!me.isLocked) {
e.preventDefault();
e.stopPropagation();
me.isDrawing = true;
me.context.beginPath();
me.context.moveTo(e.offsetX || e.layerX, e.offsetY || e.layerY);
}
},
draw: function(e) {
var me = this;
if (me.isDrawing) {
e.preventDefault();
e.stopPropagation();
me.context.lineTo(e.offsetX || e.layerX, e.offsetY || e.layerY);
me.context.stroke();
}
},
CSS does the trick for IE 11 (prefixed for IE 10)
touch-action: none
Touch events are pointer events in IE11 (prefixed for IE 10).