Skip to content

Commit

Permalink
undo to beginLine
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Apr 2, 2024
1 parent 4f7d405 commit 813dbb4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function resizeCanvas() {
// that the state of this library is consistent with visual state of the canvas, you
// have to clear it manually.
//signaturePad.clear();

// If you want to keep the drawing on resize instead of clearing it you can reset the data.
signaturePad.fromData(signaturePad.toData());
}
Expand Down Expand Up @@ -85,7 +85,8 @@ undoButton.addEventListener("click", () => {
const data = signaturePad.toData();

if (data) {
data.pop(); // remove the last dot or line
// remove the last dot or line
while(!data.pop().beginLine);
signaturePad.fromData(data);
}
});
Expand Down
2 changes: 1 addition & 1 deletion docs/js/signature_pad.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/signature_pad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default class SignaturePad extends SignatureEventTarget {

// The "Scribble" feature of iOS intercepts point events. So that we can lose some of them when tapping rapidly.
// Use touch events for iOS platforms to prevent it. See https://developer.apple.com/forums/thread/664108 for more information.
if (window.PointerEvent && isIOS) {
if (window.PointerEvent && !isIOS) {
this._handlePointerEvents();
} else {
this._handleMouseEvents();
Expand Down

0 comments on commit 813dbb4

Please sign in to comment.