Repository navigation
Add TransformBox, move and scale handles on a rectangle in its own frame - #593
Merged
Merged
Conversation
…ame [minor] A rectangle with corner and edge handles, held in a frame of the caller's choosing and drawn through a Matrix3x2 to the screen. Dragging the body moves it, an edge moves that edge, and a corner moves both edges or scales about the opposite corner. Hit-testing is on screen, so the grab radius is the same however the frame is stretched or turned; the drag is measured in the frame as it was at the press, so a caller whose edit moves the frame gets a stable answer. The box submits its hit area only over itself, so a press elsewhere still pans a canvas underneath, and a caller's own rule can replace the built-in resize. This is the rect-with-handles ImageGui's crop kept local until a second consumer existed; its layer arranging is that consumer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSx9oajT9nHUKVaNDS3pfi
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSx9oajT9nHUKVaNDS3pfi
|
This was referenced Oct 7, 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.



Requested by Matt · project thread
Before: there was no widget for dragging a rectangle with handles through an arbitrary transform.
CropOverlayis a crop in image pixels with its own rotation, and ImageGui kept its own crop handles locally until a second consumer turned up.After:
ImGuiWidgets.TransformBoxdraws a rectangle with corner and edge handles in its own frame, through a caller-suppliedMatrix3x2, and lets the user move it, resize it and scale it. A crop passes the image's rectangle on screen; a layer passes its placement composed with that, so its handles sit on its turned corners. ImageGui's M5c layer arranging is the second consumer.How: hit-testing happens on screen (the grab radius is screen pixels however the frame is stretched or turned, and shrinks inside a box too small for its handles so it keeps a body), while drags are measured in the frame as it was at the press, so a caller whose edit moves the frame gets a stable answer. Corners are free by default or uniform with
UniformCorners(Shift inverts), and a uniform corner scales by the pointer's travel along the diagonal on screen. The box submits its hit area only over itself or while held, so a press elsewhere still reaches anImageCanvaspan underneath.TransformBoxOptions.Resizelets a caller replace the built-in rule, which is how a crop keeps its aspect presets. The rules live in the ImGui-freeTransformBoxState.Comes with state unit tests (19), an isolation suite (10), a widgets demo section with a UI test, a gallery tile, and README/CLAUDE.md entries. Locally: Widgets.Tests and the full ImGui.Widgets.UITests suite (680) pass, WidgetGallery.UITests pass, and
--checkreports every widget has a tile.🤖 Generated with Claude Code
https://claude.ai/code/session_01HSx9oajT9nHUKVaNDS3pfi
Generated by Claude Code