From dde09b5db239b2608225a6859d96ca96570af6ec Mon Sep 17 00:00:00 2001 From: Tom Maitland Date: Mon, 24 Apr 2017 15:07:05 +1000 Subject: [PATCH] Block default touch functionality on the canvas This prevents the canvas scrolling the page when you try to sign on a touch device (like an iPad) --- src/signature.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/signature.js b/src/signature.js index cc4676a..d484776 100644 --- a/src/signature.js +++ b/src/signature.js @@ -135,14 +135,15 @@ angular.module('signature').directive('signaturePad', ['$interval', '$timeout', element.on('touchstart', onTouchstart); element.on('touchend', onTouchend); - function onTouchstart() { + function onTouchstart(event) { scope.$apply(function () { // notify that drawing has started scope.notifyDrawing({ drawing: true }); }); + event.preventDefault(); } - function onTouchend() { + function onTouchend(event) { scope.$apply(function () { // updateModel scope.updateModel(); @@ -150,6 +151,7 @@ angular.module('signature').directive('signaturePad', ['$interval', '$timeout', // notify that drawing has ended scope.notifyDrawing({ drawing: false }); }); + event.preventDefault(); } } };