Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toRawSvg does not display individual strokes if controller is initialized with points #113

Open
rfitz123 opened this issue Nov 19, 2024 · 0 comments

Comments

@rfitz123
Copy link

rfitz123 commented Nov 19, 2024

If I take the points from one controller and initialize another with those points, toImage will work as expected, but toRawSvg will connect individual strokes together, exactly like #87.

This is due to the fact that toRawSvg is using _latestActions to determine strokes, as opposed to the PointType of each point, which is how strokes are distinguished everywhere else.

I would venture a guess that toRawSvg should split points into strokes based on PointType (same as the other methods of drawing) rather than piggybacking on _latestActions, which is only used to support undo/redo functionality. If I'm initializing a controller with points, I would not necessarily expect undo/redo functionality to be supported, but I would definitely expect toRawSvg to distinguish between separate strokes.

Workaround

We are storing signatures as strokes on our side, so our workaround was to loop through the strokes, setting points and calling pushCurrentStateToUndoStack for each stroke. This will populate _latestActions with a list of strokes as toRawSvg expects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant