generic-github-user / Caesium

General-purpose AI library with NEAT-style genetic algorithm.
https://generic-github-user.github.io/Caesium/src/versions/javascript/projects/network-visualization/
MIT License
1 stars 1 forks source link

Node value numbers are off-center #48

Closed generic-github-user closed 5 years ago

generic-github-user commented 5 years ago

I've tried everything.

generic-github-user commented 5 years ago

Interesting . . . svg.getBBox() shows different dimensions than the DevTools window . . .

image

image

generic-github-user commented 5 years ago

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.

generic-github-user commented 5 years ago

This seems to work fine for the width, but the height is still off by a little bit.

image

generic-github-user commented 5 years ago

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.

generic-github-user commented 5 years ago

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.

generic-github-user commented 5 years ago

It turns out even when directly aligned with the center of the node, because of spacing, the text looks misaligned. Good to know.

image