Repository navigation
[patch] Keep comment boxes with their nodes when the view pans or fits - #607
Merged
Merged
Conversation
A pan shifts every node's editor-space position, which the renderer reports back as every node moving, and FitToView moved only the nodes. Comment boxes are drawn from the engine's space with no panning term, so both left the boxes behind: nodes slid out of their boxes on screen and GetNodesInCommentBox stopped finding them. GetNodePositionUpdates now shifts every box by the panning delta since its last call, and FitToView includes the boxes in its bounds and offsets them with the nodes. Fixes #478 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTeaDNAaTEviJbNWuEi5hP
|
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #478
What was wrong
Comment boxes are drawn at
canvasOrigin + ToView(box.Position), with no panning term. Two view operations moved nodes and left the boxes behind:GetNodePositionUpdatesreports that back as every node moving.FitToView. It computed its bounds over nodes only, and offset only the nodes.As a result, nodes slid out of their boxes on screen, and
GetNodesInCommentBoxstopped finding them. Moving or deleting a box then silently missed its contents.Change
NodeEditorEngine.OffsetCommentBoxes(delta)(internal): shifts every box without carrying anything. Here the nodes move on their own, soMoveCommentBoxwould move them twice.NodeEditorRenderer.GetNodePositionUpdates: readsImNodes.EditorContextGetPanning()and shifts the boxes by the change since its last call, divided byZoom. The view transform is linear with slopeZoom, so this matches exactly how far the nodes are reported to move.FitToView:false.Tests
New
CommentBoxViewTestsrun real frames in the headless harness, with a node at (200, 200) andCreateCommentBoxAround:Panning_CarriesCommentBoxesWithTheirNodes: middle-drag across empty canvas. The node moves, its offset within the box is unchanged, andGetNodesInCommentBoxstill holds it.FitToView_CarriesCommentBoxesWithTheirNodes: the same assertions afterFitToView.FitToView_CentresTheBoxesAsWellAsTheNodes: the enclosing box ends up centred on the view.How the tests were checked:
ImGui.NodeEditor.Tests: 273/273 pass.ImGuiAppDemo.UITestsCleanImNodes_*(includingFitToViewFitsTheGraph): 7/7 pass. These need the LFS assets pulled.🤖 Generated with Claude Code
https://claude.ai/code/session_01TTeaDNAaTEviJbNWuEi5hP
Generated by Claude Code