fix: incomplete path not included on saving #116
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Sketch Canvas Save Functionality - Incomplete Strokes Now Preserved
Description
Fixed a critical issue where incomplete drawing strokes were not included in saved images, causing user work to be lost when save operations were called before stroke completion.
Issue Analysis
The original implementation had a fundamental design flaw where the save functionality only captured completed paths from
_frozenImage
but ignored incomplete strokes in_currentPath
. This created a timing-dependent failure where:Root Cause: The code assumed every drawing gesture would complete normally via
onPanResponderRelease
, but real-world scenarios (system interruptions, app switching, gesture conflicts) could prevent this from happening.Solution
Enhanced the
createImageWithTransparentBackground
method to include incomplete paths in saved images:Key Benefits:
Testing
Tested Scenarios:
endPath
is delayedTest Cases:
Before/After
Before: Incomplete strokes visible on screen but missing from saved images
After: All visible strokes (complete and incomplete) are preserved in saved images
Checklist
Related Issues