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
Node not counted as hovered while dragging #309
Comments
@AgustinBanchio thanks for your request. By design this module considers that a node can only be in hover mode or in drag mode, but not both simultaneously. Considering a node as being hover while dragging at the same time has proved problematic. Largely because as you're dragging the node, often it's being pulled in the opposite direction by the graph, which causes it to move in and out of the mouse hovering area. This in turn cause multiple calls to However, keep in mind that you can still have the best of both worlds, by using |
Hi @vasturiano thanks for responding so quickly. If I consider the node to be in the hover state when dragged, I get problems when dragging stops. Resulting in quick flashing occurring just when dropping the node. Sometimes the node gets dropped while not hovering over it and sometimes hovering over it, so I can't just assume that when dragging stops the hovering continues. Is there any way to get an instant hovering recomputation as soon as dragging ends? (kinda like we get a hover callback as soon as dragging starts) |
@AgustinBanchio the |
When onNodeDragEnd event happens, how do I know if the cursor is hovering over the node? |
Describe the bug
When I hover over a node, the event
onNodeHover
gets fired. But when I start dragging the node, the event gets refired with null (as if it was stopped being hovered).Then, when the dragging ends, it can take a while until the event gets refired to indicate that the node is hovered.
I'm applying a different style to all nodes depending on if they are being hovered (or their surrounding nodes) or not (GIF 1).
When I start dragging, the graph says the node is not being hovered any more (GIF 2).
I want that style to remain while dragging, and to remain after dragging if still hovering.
I tried to keep counting the node as hovered if dragging (ignore hover events while dragging) but when letting go there will be no event indicating when it stops being hovered (GIF 3).
I then tried listening to the
onNodeDragEnd
event to stop counting the node as hovered, but the newonNodeHover
event doesn't come at the same time, so there's a small hiccup where no node gets counted as hovered (GIF 4).To Reproduce
On any graph with onNodeHover event, drag a node and it won't be considered hovered anymore. When dragging stops, there's a small delay until being considered hovered again as well.
Expected behavior
onNodeHover null is only emitted when the mouse moves out of the node.
Screenshots
[1] - Desired Hover Styling:
[2] - Reacting only to onNodeHover and dragging (no node counted as hovered when dragging):
[3] - Attempting to count node as hovered when dragged (sometimes nodes keep being considered hovered when not hovering anymore):
[4] - Stop counting node as hovered on drag end (there's a small bit of time between dragging ending and node being considered hovered again, see other nodes flashing):
[5] - Events fired (deduplicating drag) with ms timestamp:
Between dragEnd and the hover event (without moving the cursor). You can see that from drag to hover null there's almost no delay but from dragEnd to hover (actual node) there can be like 400-500ms or more of delay (leading to the flashing reaction).
Desktop (please complete the following information):
Additional context
Is there any config to treat dragged nodes as hovered and only emit the null event when stopping hovering after dragging ends?
The text was updated successfully, but these errors were encountered: