d3plus / d3plus-text

A smart SVG text box with line wrapping and automatic font size scaling.
MIT License
105 stars 18 forks source link

Improve wrapping behavior - break mid-word #106

Open vincerubinetti opened 5 years ago

vincerubinetti commented 5 years ago

Related to #95.

If a word is too long to fit on a line, it wont be shown at all. With a custom ellipsis function, you can replace an empty string with ... to at least show there was supposed to be something there. But the expected behavior would be breaking in the middle of the word, and pushing the remainder to the next line (or adding a ... if no more lines are available).

Test ground for word wrapping/splitting. Resize the first box. http://jsfiddle.net/5krvb8f7/2/

The ideal behavior would be the behavior of <textarea>, or the regular html <div> with word-break: break-word.

I understand that this is not a trivial thing to accomplish, but I do think it's essential. Without it, the plugin is almost useless (at least in my use case).