Skip to content

Commit

Permalink
Merge pull request #481 from DocSpring/fix_strokeUpdate_race_condition
Browse files Browse the repository at this point in the history
Fix #480 - Fix race condition / edge case in _strokeUpdate where this._data can sometimes be []
  • Loading branch information
szimek committed Jul 15, 2020
2 parents 7689c82 + 7bb89ac commit efca705
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/signature_pad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ export default class SignaturePad {
}

private _strokeUpdate(event: MouseEvent | Touch): void {
if (this._data.length === 0) {
// This can happen if clear() was called while a signature is still in progress,
// or if there is a race condition between start/update events.
this._strokeBegin(event)
return
}

const x = event.clientX;
const y = event.clientY;

Expand Down

1 comment on commit efca705

@kudoro
Copy link

@kudoro kudoro commented on efca705 Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when are you planning to push this to master @szimek

Please sign in to comment.