Skip to content

Rotate/resize the transform tools with a rectangle handle (fixes #585) - #2239

Open
zbcoding wants to merge 1 commit into
PintaProject:masterfrom
zbcoding:feature/rotate-scale-transform-handles
Open

Rotate/resize the transform tools with a rectangle handle (fixes #585)#2239
zbcoding wants to merge 1 commit into
PintaProject:masterfrom
zbcoding:feature/rotate-scale-transform-handles

Conversation

@zbcoding

Copy link
Copy Markdown

This picks up the draft #1515 (thanks @cameronwhite) and completes its checklist. All four items are implemented:

  • Use the rectangle handle to control scaling — anchored to the opposite corner/edge (Ctrl anchors to center).
  • Dragging to translate the region updates the rectangle handles — mouse and arrow-key nudge both keep the grips glued.
  • Rotations also rotate the rectangle handles.
  • Shift constrains to the original aspect ratio, not to a square.

How rotation of the handles works

A live orientation matrix maps a fixed reference rect onto the current on-screen quad, so the 8 grips draw and hit-test at the rotated corner/edge positions. A grip drag is mapped back through the inverse of that matrix, the resize is computed in the reference frame (reusing the corner/edge/flip/aspect math), and re-applied as g = live · s · live⁻¹ — so rotated content scales along its own axes with the opposite oriented corner pinned and no shear. live only ever composes rotation + reference-axis scale + translation, so it always maps to a proper (non-sheared) rectangle.

Extras beyond the #1515 checklist

  • Corner/edge handles can flip/mirror the content when dragged past the opposite edge.
  • Modifier-key hint on hover over a grip.
  • Arrow-key nudge shortcuts (Shift = 10px, Ctrl = 10% of canvas) with a hint popover after a short hold (issue Arrow keys should move selection by 10 pixels with Shift #1559).
  • A high-contrast bidirectional rotate cursor icon for the Alt-drag rotation.

Credit

Builds on the handle-resize approach from @cameronwhite (#1515, #1712) and @marcovr (master...marcovr:Pinta:allow-handle-resize).

Testing

Builds clean (0 warn / 0 err). The rotated-frame scaling math is covered by a standalone self-check against the real Cairo matrix binding (opposite corner stays fixed, dragged corner follows the mouse, handles stay glued, quad stays rectangular). Smoke-tested manually in the app; I'd appreciate maintainer review of the interaction feel and edge cases.

Fixes #585.

@zbcoding
zbcoding force-pushed the feature/rotate-scale-transform-handles branch 2 times, most recently from f9fe7d1 to 21aba09 Compare July 29, 2026 09:39
…aProject#585)

Completes the checklist from the draft PR PintaProject#1515 by wiring RectangleHandle
into BaseTransformTool so the Move Selected/Selection tools expose grips:

- Use the rectangle handle to control scaling, anchored to the opposite
  corner (or edge) instead of the center; Ctrl anchors to the center.
- Dragging to translate (mouse or arrow keys) keeps the handles glued to
  the moved region.
- Rotations rotate the handles too: a live orientation matrix maps a fixed
  reference rect onto the current on-screen quad, and grip drags are mapped
  back through its inverse so rotated content scales along its own axes with
  the opposite oriented corner pinned and no shear.
- Shift constrains to the content's original aspect ratio rather than to a
  square.

Also draggable corners can flip/mirror the content when pulled past the
opposite edge, and holding a modifier over a grip shows a hint. Arrow keys
nudge (Shift = 10px, Ctrl = 10% of canvas) with a hint after a short hold
(issue PintaProject#1559). Adds a high-contrast bidirectional rotate cursor icon.

Credit: cameronwhite (draft PR PintaProject#1515, refactor PR PintaProject#1712) and marcovr
(master...marcovr:Pinta:allow-handle-resize) for the handle-resize approach
this builds on.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@zbcoding
zbcoding force-pushed the feature/rotate-scale-transform-handles branch from 21aba09 to d1171aa Compare July 29, 2026 10:35
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.

Resize selection relative to opposite corner instead of center.

1 participant