Skip to content

Commit

Permalink
fix: unexpected dot when resuming drawing (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenJeau authored Dec 23, 2020
1 parent 10d6987 commit 595a57c
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/Draw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,24 +371,26 @@ const Draw = forwardRef<DrawRef, DrawProps>(
}: PanGestureHandlerStateChangeEvent) => {
focusCanvas();

if (state === State.BEGAN) {
addPath(x, y);
} else if (state === State.END || state === State.CANCELLED) {
setPaths((prev) => [
...prev,
{
color,
path: createSVGPath(
path,
simplifyOptions.simplifyPaths ? simplifyOptions.amount! : 0,
simplifyOptions.roundPoints!
),
data: path,
thickness,
opacity,
},
]);
setPath([]);
if (!penOpen && !colorPickerVisible) {
if (state === State.BEGAN) {
addPath(x, y);
} else if (state === State.END || state === State.CANCELLED) {
setPaths((prev) => [
...prev,
{
color,
path: createSVGPath(
path,
simplifyOptions.simplifyPaths ? simplifyOptions.amount! : 0,
simplifyOptions.roundPoints!
),
data: path,
thickness,
opacity,
},
]);
setPath([]);
}
}
};

Expand Down

0 comments on commit 595a57c

Please sign in to comment.