Take the zoom from the node editor rather than doing it here - #21
Merged
Merged
Conversation
…e [patch] ktsu.ImGui.NodeEditor 3.20.0 has NodeEditorRenderer.Zoom and FitToView, so this application's own copy comes out: EnterViewSpace, LeaveViewSpace, IsUnzoomed, the ViewState record and its dictionary, the min/max/margin constants, and FittingZoom. Zoom now forwards to the renderer's, and FitView hands it the canvas — the world origin is kept on the middle of the canvas, so twice the origin is the whole of it. The library does it better than this could from outside. The transform now sits at the seam between the engine and ImNodes rather than being wrapped around the whole frame, so nothing zoomed ever reaches the engine at all rather than being put back afterwards; the node editor's own lengths — padding, corner rounding, pin sizes, grid spacing — scale with the text, which is not reachable from here; and a size measured while zoomed is no longer trusted as the node's size, which is what the version here got wrong first time round. Of the three tests, the two that only restated library behaviour go: what is left is that the editor hands over the right canvas, which no test in the library could catch, and that Zoom really is the renderer's rather than a second value beside it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QwzCFb8zhd263sZeRbF7ba
|
matt-edmondson
deleted the
claude/auto-layout-expression-editor-ugcdvj
branch
September 8, 2026 08:37
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.



ktsu.ImGui.NodeEditor3.20.0 carriesNodeEditorRenderer.ZoomandFitToView(ktsu-dev/ImGuiApp#359), so this application's own copy comes out. Net −197 lines.What goes
EnterViewSpace,LeaveViewSpace,IsUnzoomed, theViewStaterecord and the dictionary it lived in, thefontScaledflag, theMinZoom/MaxZoom/FitMarginconstants, andFittingZoom.Zoomnow forwards torenderer.Zoomrather than holding a second value beside it.FitViewcallsrenderer.FitToView(Graph.Engine, Graph.Engine.WorldOrigin * 2f)and keeps its own return value and status message — the world origin is kept on the middle of the canvas, so twice the origin is the whole of it. The toolbar slider takes its bounds fromNodeEditorRenderer.MinZoom/MaxZoom.Why the library's is better, not just tidier
Three things the version here could not do from outside the renderer:
Tests
328 passing (329 before; two zoom tests removed, one rewritten).
FitView_DoesNotMagnifyAGraphThatAlreadyFitsonly restated library behaviour, so it goes — the library tests it. The two kept are the ones the library cannot cover:FitView_ZoomsOutUntilTheGraphFitsnow stands for the plumbing: that this application hands over the right canvas. Passing the wrong rectangle would fit the graph to the wrong thing and no library test would notice.Zoom_IsTheRenderersOwn(wasZoom_IsHeldWithinTheRangeTheSliderOffers) asserts the property forwards, using the renderer's clamping as the evidence: a value it would refuse coming back changed is what says the property didn't just store what it was given.Verified visually through the harness: the graph at 100%, at 50% with grid and node chrome scaled together, and back to 100% in exactly its original size and place.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QwzCFb8zhd263sZeRbF7ba
Generated by Claude Code