Closed generic-github-user closed 5 years ago
Interesting . . . svg.getBBox()
shows different dimensions than the DevTools window . . .
It could be getting the dimensions of what is actually being displayed in the element - the bounding box of the SVG element's content, instead of the element itself. svg.getBoundingClientRect();
works fine.
This seems to work fine for the width, but the height is still off by a little bit.
We can get pretty close with y += to_percent.h(text.getBBox().height / 3);
, but it's a quick fix, and I'm not sure why this is still an issue.
I also checked the nodes to make sure they were being rendered in the right place. Not sure what's causing this, but it doesn't seem worth worrying about for much longer. I'm going to leave this issue open for now.
It turns out even when directly aligned with the center of the node, because of spacing, the text looks misaligned. Good to know.
I've tried everything.