question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setCharacter adds a character instead of replacing it

See original GitHub issue

Below 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.

screen shot 2018-09-18 at 09 57 23

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:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
josephjohnstoncommented, Jul 31, 2019

Yes, I’m using HanziWriter.create. Thanks for your attention to this

0reactions
chanindcommented, Jul 31, 2019

🎉 This issue has been resolved in version 2.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing one character in a string - python - Stack Overflow
' Basically, I'm "adding"+"strings" together into a new string :).
Read more >
Replace a character at a specific index in a String in Java
In Java, here we are given a string, the task is to replace a character at a specific index in this string. Examples:...
Read more >
Add a Character to a String at a Given Position - Baeldung
In this quick tutorial, we'll demonstrate how to add a character at any given position in a String in Java.
Read more >
Python Replace Character in String - FavTutor
Learn how to replace a character in a string in python by using replace () method. Also, understand python strings with example.
Read more >
If characters aren't displayed correctly in TextEdit on Mac
If characters aren't displayed correctly when you open a TextEdit file, you may need to change the text encoding.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found