-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Hover Behavior on Nodes and a Potential Solution #1399
Labels
Comments
+1 |
foxton9
changed the title
Incorrect Hover Behavior on Nodes Due to Potential Coordinate Offset in getPixelColor
Incorrect Hover Behavior on Nodes and a Potential Solution
Jan 16, 2024
NiBrc
added a commit
to UniTuebingen-BDVA/sigma.js
that referenced
this issue
Jan 17, 2024
jacomyal
added a commit
that referenced
this issue
Jan 18, 2024
This commit adds the devicePixelRatio into consideration when calling getPixelColor as suggested by foxton9 (thanks a lot!), and also fixes the texture size. Without fixing the texture size, the first fix would work, but only on a fraction of the stage, with a devicePixelRatio different than 1 (for instance, with a devicePixelRatio of 2, only a fourth of the screen would be interactive...).
Thanks a lot for this very detailed report. I just pushed the fix (based on your inquiry, thanks again), and I hope to release a new beta tomorrow, with fixes on the other issues you linked. |
Version 3.0.0-beta.5 has just been published, and includes the fix for this issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The node should become hovered as the cursor enters the node.
Only when the cusor positioned at the buttom-right side of the node with some offset, the intended node will become hovered.
#1398 reported similar issues.
The issue might be due to DPI scaling not being accounted for in the coordinate calculation in the
getNodeAtPosition
function.sigma.js/packages/sigma/src/sigma.ts
Lines 450 to 451 in a4a6893
Updating the coordinate calculation to consider the device's pixel ratio could solve this this issue, however, it's worth considering that there may be other potential problems that have been missed.
The code change could be as follows:
Pixel ratio should also be the considered when binding
pickingTexture
.sigma.js/packages/sigma/src/sigma.ts
Lines 407 to 408 in a4a6893
by multiplying the ratio
This method appears to resolve an error that was reported in the browser console.
The text was updated successfully, but these errors were encountered: