vijithassar / d3-textwrap

painless cross-browser line wrapping for text passages in SVG projects built with D3.js
MIT License
154 stars 21 forks source link

callback function once wrapping complete? #18

Open heaversm opened 6 years ago

heaversm commented 6 years ago

I want to position the newly wrapped text, but I've noticed that immediately after .call(wrap) if I try to get the boundingClientRect, it is not accurate. I need to set a short timeout (~100ms) to get the right calculated bounds.

vijithassar commented 4 years ago

That's definitely unexpected, but I'm reluctant to add a callback argument to the API of this function in order to fix it – maybe use a MutationObserver instead?