Skip to content
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

leaveNode is not fired when node is moved outside of cursor (e.g. due to a ForceSupervisor) #1396

Open
nitzanhen opened this issue Dec 13, 2023 · 2 comments

Comments

@nitzanhen
Copy link

I have a graph that uses ForceSupervisor and supports drag & drop.
When dragging a node and letting go, the forces might move it away from the cursor - but the leaveNode event isn't fired in that case, until the user manually moves the cursor.
This is a problem, for example, when applying "active" styles on a node that's being hovered or dragged - when ending the drag, the "active" styling remains on the element, although it's neither hovered nor dragged anymore.

Sigma.js version: 3.0.0-alpha3
Graphology version: 0.25.4
Operating System: Windows 10
Web browser: Electron 22.3.4 & Firefox 120.0.1

Steps to reproduce

See the CodeSandbox example, which is modified from the interactivity example found on the readme.
To reproduce the error, drag a node from the cluster out, then release without moving the cursor - it should fly back to the cluster and away from the cursor, but the leaveNode event is not fired (only the clickNode event). Moving the cursor does cause the event to be fired.

Expected behavior

The leaveNode event should fire as soon as the cursor is not in its bounds, even if the node moving is what changed.

Actual behavior

The leaveNode event is not fired until the user moves the cursor.

If this is the intended behavior, is there a good workaround to detect that the cursor is no longer on the node?

Thanks for your time, and I appreciate the effort that you've put into this awesome project!

@nitzanhen nitzanhen added the bug label Dec 13, 2023
@nitzanhen nitzanhen changed the title leaveNode is not fired when node is moved outside of cursor (e.g. due to a ForceSuperviser) leaveNode is not fired when node is moved outside of cursor (e.g. due to a ForceSupervisor) Dec 15, 2023
Copy link

stale bot commented Jan 26, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 26, 2024
@jacomyal jacomyal added pinned and removed wontfix labels Jan 30, 2024
@jacomyal
Copy link
Owner

Yes, this issue is very legit. It's a bit hard to solve, because of the current split between the mouse captor and the touch captor. I add the "pinned" tag so that it stays open. Thanks a lot for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants