Skip to content

Skew the transform box by Ctrl-dragging an edge - #615

Merged
matt-edmondson merged 2 commits into
mainfrom
claude/project-thread-tizu36
Oct 10, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
claude/project-thread-tizu36

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Before: TransformBox could move, resize and scale a rectangle, but never slant it.

After: with TransformBoxOptions.Skew on, Ctrl-dragging an edge handle slides that edge along itself while the opposite edge stays put, turning the box into a parallelogram. ImageGui's Arrange tool needs this to skew layers.

How: TransformBoxRect gains a Skew init property, a shear about the rectangle's centre, plus Shape() (the shear as a matrix to fold into whatever the box frames), Center, IsSkewed, and Corners() now return the parallelogram. Min/Max stay the unskewed rectangle, so an unskewed box behaves exactly as before. The stretch-or-skew choice is made at the press (TransformBoxDrag.Skew), and TransformBoxResult.Skewing reports it, or on hover what a press would do. Hit-testing follows the slant. A skewed box keeps its slant when moved or resized: the drag goes back into the unskewed rectangle and the handle's opposite edge or corner stays put. Skew is capped at 10 per axis, and two skews can't fold the box below a tenth of its area. The skew cursor points along the edge.

Tests: 11 new TransformBoxStateTests, 2 isolation UI tests (a Ctrl-drag skews; with Skew off, Ctrl still stretches), and a demo UI test. The demo gains a "Ctrl skews" toggle and now keeps the layer as a matrix so it can hold a skew. The gallery tile shows a skewed box. README and CLAUDE.md are updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PqnpZgNq3MNw8X8yEeUqJL


Generated by Claude Code

TransformBoxOptions.Skew turns a Ctrl-drag on an edge handle into a skew
along that edge, the opposite edge staying put. TransformBoxRect gains a
Skew (a shear about its centre) with Shape() and skewed Corners(); a
skewed box keeps its slant when moved or resized. The demo, gallery tile,
README and isolation tests cover it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PqnpZgNq3MNw8X8yEeUqJL
@matt-edmondson matt-edmondson self-assigned this Oct 10, 2026
Comment thread ImGui.Widgets/TransformBoxState.cs Fixed
Comment thread ImGui.Widgets/TransformBoxState.cs Fixed
Comment thread ImGui.Widgets/TransformBoxState.cs Fixed
Comment thread ImGui.Widgets/TransformBoxState.cs Fixed
Comment thread ImGui.Widgets/TransformBoxState.cs Fixed
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PqnpZgNq3MNw8X8yEeUqJL
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants