Open Hypercubed opened 8 years ago
That was the intended behavior. I've always just enabled the fontResize and this took care of shrinking the text to fit.
That being said, I have no problem adding in a "overflow" boolean.
I was going to do a PR but see it is already done. Have you considered instead of just a boolean, add a few options like 'clip', 'resize', 'hidden', 'overflow'?
hmm interesting, can you describe the difference between "clip" and "hidden", and how "resize" differs from the fontResize method?
definitely wouldn't mind you taking a crack at it if you feel comfortable
My idea was the following:
'hidden' - hide the entire text that overflows, this is the current default. I guess this name can be easily confused with clip.
'visible' - just show it.
'clip' - draw a binding box (defined a clip path?) and hide the overflow.
'resize' - force resize when text overflows. I realized later this is the same as setting fontMin === font Size.
Thank you for making this a standalone module. It took me some time to figure out the new API so perhaps I am missing something.
What I am seeing is that if a word is too long for the bounding box it is omitted completely. I believe this is happening here: https://github.com/d3plus/d3plus-text/blob/master/src/box.js#L189 . If I comment out this line the labels that are too long for the bounding box overflow. Not sure if this is by design, perhaps it should be an option at least.
I'm using the module like this: