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

hint: Resize dynamic paths #64

Open
razvanioan opened this issue Jan 30, 2021 · 0 comments
Open

hint: Resize dynamic paths #64

razvanioan opened this issue Jan 30, 2021 · 0 comments

Comments

@razvanioan
Copy link

I've been working on a big project involving dynamic interactive SVG drawings using Vue.js & SVG.js.

One problem I've faced for a resizable dynamic path (dynamic meaning that the path definition changes from UI using Vue state) was that after first resize, whenever I was changing the path from the app UI and another resize was started again, during resize the path had the old shape

I've looked into the code to discover the cause, and I've found out that the first resize it's storing the path definition as an array of points into an _array property of the SVG object.

Then I've found that for paths there is a clear() method on the SVG library, which does just that, it clears this array, so next time it will be regenerated

Thus, in order to fix my bug I just had to call this path.clear() method after each patch change / update

Maybe this will help others!

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