-
Notifications
You must be signed in to change notification settings - Fork 326
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
Sometimes when in 'connection mode' the ports are not attachable and instead I can move nodes with my mouse #6850
Comments
I seem to be encountering this relatively often. It looks like a potential regression, because I don't remember seeing this issue happen so often in the past. |
This looks like a serious regression. CC @Frizi |
Reproduced. When you picked something in drop down (what have arguments) and then try to connect to this argument, it happens. You can connect to it right after opening project (without touching drop-down), and sometimes editing node in CB enables it as well. |
I'm able to reproduce it as well, thanks @farmaazon for the steps. looks like the issue is not really about the specific ports being not attachable, but the whole node somehow not recognizing that it is being hovered after a value is selected from a dropdown. This state tends to fix itself after attempting the hover a few times. This behavior is very clearly visible when a debug mode is enabled. I'm going to investigate it further. |
I now know the root cause of this, which I would really consider a bug of the mouse hover events. We are using following pattern now to track whether a node or one of its widgets is hovered: let background_enter = model.background.on_event::<mouse::Enter>();
let background_leave = model.background.on_event::<mouse::Leave>();
background_hover <- bool(&background_leave, &background_enter);
let input_enter = model.input.on_event::<mouse::Over>();
let input_leave = model.input.on_event::<mouse::Out>();
input_hover <- bool(&input_leave, &input_enter);
node_hover <- background_hover || input_hover;
node_hover <- node_hover.debounce().on_change(); This pattern is common in other places of the codebase. There is an assumption that for each I tried various ways of addressing this, and found a few that surely won't work. I believe that what we actually need is a system very similar to focus handling, where the hover state is tracked by the object hierarchy itself. Otherwise it will not be possible to guarantee that event parity invariant, and properly emit events in case currently hovered element changes its parent. Additionally, the |
(from the second paragraph) Do you mean "removed from display object tree", or "dropped"? If the former, cannot we just emit "Out" event when one is removed from its parent? If the latter, then I had a similar problem, and resolved it by "garbage collector" which role is in fact "keep something alive a few frames, so it realizes is no longer on the scene and update states accordingly" - in this case I used deprecated mouse events from shape and, thanks to delaying actual dropping, the FRP network emitted proper "out" event after removing the shape. Also, cc @wdanilo as we touch EnsoGL internals here. |
The issue is that any modification within the display hierarchy can disrupt the parent chain of currently hovered object. Because we rely on those events being propagated up the tree (e.g. in the above case, we listen on So, to be very specific:
Current hover implementation only sends mouse events at most once per frame, only considered the object hierarchy right after the rendering. It basically lacks the concept of "transitively hovered" objects. All it does is sends the object once from the "directly hovered" object. enso/lib/rust/ensogl/core/src/display/scene.rs Lines 1324 to 1329 in 86432b5
We can keep the detection of "directly hovered" object that way, but the logic of maintaining "transitively hovered" object state and actually emitting appropriate events needs to be added into the display object hierarchy itself. This is a similar idea to how we are currently tracking the "focus" state.
Yes, but that "just" is doing a lot of heavy lifting here. The objects don't track their hover state yet, and once they are already removed from the parent, it is too late to send any events. There is also no way to detect that a non-direct parent is about to be disconnected and an action is needed.
At the time the objects are already in garbage collector, their parent hierarchy is destroyed and emitted events will not reach any of the old parents. I actually tried a somewhat similar approach (by implementing |
@Frizi, @farmaazon, let's have a call tomorrow about it - what do you think of it? This discussion is getting so long, that probably a call will be a lot faster than continuing it here. If it works for you, @Frizi could you schedule it afternoon please? |
We discussed the issue with hover handling on a call. The conclusions: DOM has similar issues with interaction between mouse events and elements being destroyed, but we agree that we can do better than that. We want to implement better handling of hover states, but doing it eagerly on hierarchy change (similarily to focus) will introduce unacceptable issues:
To avoid those issues, we want to implement mouse event handling as follows:
This gives us a few useful properties:
|
Recently, I've been encountering this bug daily, making it really hard to create connections - almost every other time when I try to connect one existing node to another I have to do a rollercoaster of mouse movements around various nodes before the mouse will actually 'stick' to the input port I'm aiming for. |
Let me explain with a video:
connection.maker.not.reacting.to.ports.mp4
When I drag a node output port my mouse is in 'connection mode' - I see a line from the node to the cursor. Normally, I can then attach that line to an input port and create a connection.
But as you can see on the video, this does not work - the ports do not highlight and instead I can actually move the nodes around with the cursor - as if it was in 'normal mode'. The expected behaviour is the usual one - the ports will 'accept' such an incoming connection and I should not be able to interact moving nodes around when in this 'mode'.
I'm not sure if this is a known issue but searching 'ports' did not yield anything.
The text was updated successfully, but these errors were encountered: