Skip to content

Commit 22d8019

Browse files
committed
(fix): fix incorrect isEmpty = true during strokeBegin
- strokeBegin called reset(), which set isEmpty = true , which is a bug - moved isEmpty = true logic outside of reset() as the only place it actually needs to be set to true is in clear()
1 parent 217d4a9 commit 22d8019

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default class SignatureCanvas extends Component {
5353
ctx.clearRect(0, 0, canvas.width, canvas.height)
5454
ctx.fillRect(0, 0, canvas.width, canvas.height)
5555
this._reset()
56+
this._isEmpty = true
5657
}
5758

5859
fromDataURL = (dataURL) => {
@@ -119,7 +120,6 @@ export default class SignatureCanvas extends Component {
119120
this.points = [];
120121
this._lastVelocity = 0;
121122
this._lastWidth = (this.props.minWidth + this.props.maxWidth) / 2
122-
this._isEmpty = true;
123123
this._ctx.fillStyle = this.props.penColor
124124
}
125125

0 commit comments

Comments
 (0)