Skip to content
This repository has been archived by the owner on Nov 18, 2019. It is now read-only.

Commit

Permalink
Block default touch functionality on the canvas
Browse files Browse the repository at this point in the history
This prevents the canvas scrolling the page when you try to sign on a touch device (like an iPad)
  • Loading branch information
tommaitland authored Apr 24, 2017
1 parent a8467d0 commit dde09b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,23 @@ 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();

// notify that drawing has ended
scope.notifyDrawing({ drawing: false });
});
event.preventDefault();
}
}
};
Expand Down

0 comments on commit dde09b5

Please sign in to comment.