-
Notifications
You must be signed in to change notification settings - Fork 252
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
Adds node editor MiniMap feature #99
Conversation
d9af43e
to
36c2d41
Compare
Adds mini map feature to be used between `BeginNodeEditor` and `EndNodeEditor` with following features: - provides "low detail" view of nodes/links in the graph as an overlay in the editor canvas - provides the ability to zoom in and out of this context to view more of the graph than is visible in the normal editor canvas viewport - scrolling, which scales with zoom (when zoomed out, scrolls the editor context at a faster rate) - node snapping when clicked: pans clicked node to center of canvas when mini-map node is clicked - node hovering callback, which can be used to set custom tooltips when hovering the minimap - separate color variables for the minimap bg/outline and nodes/links - four positioning options withing the editor canvas
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.
Great work @briancairl ! Two small things I think could be addressed, but beyond that I think getting this merged is definitely the next step! Some things, such as further viewport customizability, and a viewport in the minimap I think would be better informed by getting this merged and having others use the feature 👍
imnodes.cpp
Outdated
@@ -631,14 +631,35 @@ void BeginCanvasInteraction(ImNodesEditorContext& editor) | |||
|
|||
const bool started_panning = GImNodes->AltMouseClicked; | |||
|
|||
if (started_panning) | |||
// Handle mini-map interactions | |||
if (ImGui::IsWindowFocused() and |
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.
When the window is out of focus, it is possible to start a box selection inside the minimap, due to the start of the box selection interaction not being behind a window focus-check. So I think we either need to remove the ImGui::IsWindowFocused()
check here, or early-out of the function if the window is not being hovered.
ImGui doesn't prevent UI element interaction when the window is out of focus, so I think for interaction consistency it might make sense to just not have the focus check here, letting the window come in to focus when starting the interaction.
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.
Sounds reasonable to me. Will remove.
editor.Panning += GImNodes->MiniMapRectSnappingOffset; | ||
GImNodes->MiniMapRectSnappingOffset = ImVec2(0.f, 0.f); | ||
|
||
editor.ClickInteraction.Type = ImNodesClickInteractionType_None; |
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.
I think it might feel a bit more consistent if the actual snap-to-node happens when the mouse button is released. In other click-based interactions, such as clicking checkboxes, buttons, and nodes, the action only happens on mouse release.
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.
Will change to snap on mouse release.
Mini-map interaction and node/link/pin hovering interaction would clobber state related to one another. Since minimap is drawn on top, disable hovering behavior when the mouse is over the minimap AND an node/link/pin.
Adds mini map feature to be used between
BeginNodeEditor
andEndNodeEditor
with following features:imnodes_minimap_wip2.mp4