-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tree click interaction fixes #834
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all sounds sensible to me, and the code looks good. However, I have not tested it, as the deployment does not seem to be working (there is a "view deployment" button which brings up a session list, but I cannot create a new session -- it seems to be 404ing trying to hit a backend. I am a bit out of the loop on the current state of PR deployments, so maybe this is expected?)
Turns out this was because I hadn't added the label. The deployment is now working, in case you want to test it. |
Thanks. Looks good. |
I think these changes aren't quite no-brainers:
(Additionally, on the first point, if we do decide to select a the child node of an edge when the edge is selected, we might want to think about highlighting the edge, as well. That might be useful for keeping track of who the parent is in complex trees.) |
Previously, edges could be clicked and would change colour. For now at least, there are no interactions we perform on edges, so this was potentially confusing.
This makes it clear that nodes can be clicked on, but not edges, and that only the background can be used for drag-to-pan. One might hope that ReactFlow would handle this for us, but it doesn't go far enough, perhaps because its main intended use case involves more interactivity, whereas we essentially just use it for rendering.
This was made possible by recent changes to make `PrimerNode` a proper discriminated union.
One more thing while I'm thinking about it, and this is not a criticism of this PR, just a related idea: is there any good reason why we don't support dragging the canvas regardless of what the cursor is hovering over? Since we're not planning to use drag interactions on nodes or edges, why not just make it really easy to drag the canvas, rather than requiring the student to mouse over/touch an inert part of the canvas before it can be dragged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments above. I could be talked out of the selectable edge suggestion, but I think the dotted-edge behavior should be fixed, regardless.
58c8c34
to
ec4a88b
Compare
See the latest version (though the implementation needs cleaning up a tad). I kind of like it, although I agree that we should ideally somehow highlight edges, or maybe highlight the node when the edge is hovered (which might be awkward to implement), and I'm not really sure what that should look like. I also think the "interaction width" around edges is a little high, but that's easily fixed.
This is new, and I hadn't noticed it, and agree it's annoying. As it happens, the previous fix solves it as a side-effect. I'm not actually sure of another simple way to do so.
Because ReactFlow doesn't support it, unfortunately. |
Yeah, if we're going to make the edges selectable, then we should probably highlight them when hovered, as we do for nodes (though obviously not via the ring effect). But we can merge selectable edges without the highlighting support. I see that the current implementation is marked as a hack, so it's understood that you didn't intend for it to be proper support. With that in mind, there are a few issues with it. There seems to be some "right-bias", in that (on Safari, anyway) as the edges start to converge near the parent, at some point the right edge is selected even when the cursor is pretty clearly over the left edge. Here are a few examples, the first of which occurs around 15s into this screen capture: Screen.Recording.2023-03-22.at.5.49.20.PM.movHopefully this can be fixed by making the selection area smaller or something like that. I figured that one issue with the suggestion that edges be selectable would be, "which one is selected when the edges converge at the root?" I think I'd have preferred the left edge be the one selected, but it seems to be the right one. It's not the end of the world, though. |
I can confirm that on Safari on macOS, this appears to be fixed now, which is I guess another reason to support selecting edges :)
Hmm, that's unfortunate. Is there an existing issue in upstream for this? |
Note to self: when revisiting this, consider how it interacts with #931. |
These small changes all started as part of #833, but whereas what remains there is at least controversial, these all seem like no-brainers.