personalizedrefrigerator / js-draw

Draw pictures using a pen, touchscreen, or mouse! JS-draw is a freehand drawing library for JavaScript and TypeScript.
https://personalizedrefrigerator.github.io/js-draw/typedoc/
MIT License
79 stars 8 forks source link

fix(editor): Fix strokes drawn with non-primary styluses never finalized #73

Closed personalizedrefrigerator closed 2 months ago

personalizedrefrigerator commented 2 months ago

Summary

This pull request updates Pen.ts to finalize strokes only when the pointer that created them is lifted.

Previously, Pen.ts incorrectly relied on isPrimary to determine whether a pointerup event should cause a stroke to be added to the image or ignored. This could be problematic — nonprimary pointers can start strokes. Additionally, in the case of #71, the primary pointer was not marked with isPrimary.

Testing

An automated test has been added in Pen.test.ts. This test should verify that strokes created with a non-primary pen are added to the image.

Fixes #71.

github-actions[bot] commented 2 months ago

Visit the preview URL for this PR (updated for commit 3cddbe6):

https://js-draw--pr73-work-fix-stroke-with-tuli6hu4.web.app

(expires Sat, 15 Jun 2024 19:29:08 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: e560ee6f7bb6b79cb55b42fb4c05e9fd1b5c506e