neanes / neanes

Neanes is a free and open source scorewriter for notating Byzantine chant in Byzantine notation.
https://neanes.github.io/neanes/
GNU General Public License v3.0
35 stars 9 forks source link

Inline text box width incorrect with multi-line text #646

Closed basil closed 3 weeks ago

basil commented 3 weeks ago

When entering multi-line text into an inline text box (with shift-enter), the width of the inline text box is erroneously calculated as if all the text were on a single line.

danielgarthur commented 3 weeks ago

What I'm not sure about here is why I'm even attempting to calculate the text box (inline or other) when I already know the height via HTMLElement's scrollHeight... I'll take a closer look at this to see if this can be greatly simplified.

This is also relevant because of the use of pretty and balanced, which means my simple method of calculating the text width with TextMetrics may calculate the wrong height. If the browser can already tell me the height, then I shouldn't try to calculate it by hand.