jacomyal / sigma.js

A JavaScript library aimed at visualizing graphs of thousands of nodes and edges
https://www.sigmajs.org
MIT License
11.22k stars 1.59k forks source link

Bug with nodes hovering #1349

Closed jacomyal closed 7 months ago

jacomyal commented 1 year ago

Sometimes sigma does not properly detect which node is under the mouse cursor.

issue-hover-sigma

Steps to reproduce

Expected behavior

The Valjean node should be displayed as hovered, and the events log should display Event "enterNode", node Valjean (id "11.0").

Actual behavior

The Valjean node is displayed as not hovered, and the events log shows nothing.

jacomyal commented 1 year ago

The reason behind this bug is that the node sizes are not properly indexed in the quadtree: https://github.com/jacomyal/sigma.js/blob/6417696f7ceb7fefb861b2de95da2b4e535d4e27/src/sigma.ts#L817

The data.size / this.width is not the size of the node in the same coordinates system as the positions. Also, the bug can be even worse when zooming out, because the nodes are relatively bigger.

jacomyal commented 11 months ago

Once #1382 is dealt with, this issue will be solved.

krkryger commented 7 months ago

Any updates on this issue? Would be very much appreciated!

jacomyal commented 7 months ago

@krkryger This bug is solved in the v3 branch, so if you migrate to the 3.0.0-beta.5 version, it will not occur anymore.

I waited this new version to reply because, in the 3.0.0-beta.4, another bug with similar symptoms was occurring...

I use this occasion to close this ticket, since it is actually solved.