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

How to dynamically change width/height of current HanziWriter? #244

Closed
peterolson opened this issue Jul 10, 2021 · 3 comments · Fixed by #245
Closed

How to dynamically change width/height of current HanziWriter? #244

peterolson opened this issue Jul 10, 2021 · 3 comments · Fixed by #245
Labels

Comments

@peterolson
Copy link

Once I've already created a writer with HanziWriter.create, is there any way to change the width and height dynamically?

I'm setting the size of the writer based on the size of the window, but this breaks when the window is resized after the writer is created.

@chanind
Copy link
Owner

chanind commented Jul 12, 2021

There's not an easy way to do that currently, aside from doing something fancy with an SVG G element, or just deleting and recreating the HanziWriter element. I think it should be doable though to add an updateDimensions() method that will recreate the image elements in the new size while keeping the state the same. The user-drawn stroke path might be a bit weird, but maybe it will just work. I'll work on a PR...

@chanind
Copy link
Owner

chanind commented Jul 12, 2021

🎉 This issue has been resolved in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@peterolson
Copy link
Author

Awesome, works like a charm!

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

Successfully merging a pull request may close this issue.

2 participants