setCharacter adds a character instead of replacing it
See original GitHub issueBelow is a post by Mikurox from issue 55. I have the same bug and I’m wondering if I’m misunderstanding how setCharacter should work. Documentation say ‘Replace the currently drawn character with a new one’, but instead it adds a new and disfigured character like his picture shows.
Hi guys, I totally agree with you on the above, I was going to raise the following bug when I saw this one
- create a new HanziWriter() object to initialise it (it’s still hidden so not used yet)
this.writer = new HanziWriter(characterDiv, character, { width: imgWidth, height: imgHeight, padding: 5, showOutline: true, drawingWidth: 22, // thickness of the drawing delayBetweenStrokes: 400, // milliseconds showCharacter: false, highlightOnComplete: false });
- then later call the setCharacter method in order to really set the character we want you want
this.writer.setCharacter(character);
It creates 2 ‘g’ elements in the ‘svg’ one, with a bad overriding etc. as a consequence.
It may not have been the “way to use it” but in my case I would like to initialise everything before hand before even knowing which character I want to use.
So I’m looking forward for a fix as described above, or at least a fix on the new + set -> error
_Originally posted by @Mikurox in https://github.com/chanind/hanzi-writer/issues/55#issuecomment-422296468_
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Yes, I’m using
HanziWriter.create
. Thanks for your attention to this🎉 This issue has been resolved in version 2.0.3 🎉
The release is available on:
Your semantic-release bot 📦🚀