Skip to content

Clockwise-positive fine rotation + Straighten reference-line tool#460

Merged
marcinz606 merged 2 commits into
marcinz606:mainfrom
linkmodo:feature/fine-rotation-cw-positive
Jul 12, 2026
Merged

Clockwise-positive fine rotation + Straighten reference-line tool#460
marcinz606 merged 2 commits into
marcinz606:mainfrom
linkmodo:feature/fine-rotation-cw-positive

Conversation

@linkmodo

Copy link
Copy Markdown
Contributor

Summary

Two alignment-workflow improvements that share one sign convention, plus a small dialog polish.

Clockwise-positive fine rotation

The Fine Rotation slider now reads in the photographer's convention: positive turns the image clockwise on screen, negative counter-clockwise — under every flip state. The crop tool's rotation-handle angle badge and the Alt+R / Alt+Shift+R shortcut descriptions follow the same convention.

The sign flips at the display boundary only; geometry.fine_rotation keeps its internal cv2/warp convention, so every previously saved edit renders exactly as before (negating the stored convention would have silently mirrored the tilt of existing edits, with no clean migration path). Because the pipeline applies flips before fine rotation, the stored angle's on-screen direction is flip-independent — verified empirically by rotating marker pixels with and without pre-applied flips — so the single display negation holds in all flip/rotation states.

Straighten reference-line tool

A ruler button under Geometry → Alignment (default key L, rebindable in Customize, listed in the Keyboard Shortcuts dialog under Geometry): activate, draw a line along a tilted horizon or a leaning vertical edge, and the image rotates to match on release — one-shot, like Lightroom's straighten line.

  • Intent detection: lines closer to horizontal level to the horizon; lines closer to vertical plumb (e.g. a building edge). Drawing the same line from either end gives the identical correction.
  • A live badge previews the correction while dragging: "Level +1.43°" / "Plumb −5.71°", in the CW-positive display convention.
  • The delta is measured in display space and added to the current fine rotation (clamped to ±45°), landing in the same field the slider and crop handles drive — so it composes correctly under flips and 90° turns, and remains adjustable afterwards.
  • Guards: sub-8px drags ignored (accidental clicks), right-click never draws, Esc cancels an in-progress line; screen-space measurement makes zoom/pan/HQ irrelevant to accuracy.

Dialog polish

The Keyboard Shortcuts dialog's Customize/Close buttons set widget-level stylesheets with hardcoded backgrounds, which beat the app stylesheet in every state and killed the global hover-grey / pressed-red feedback. Customize now inherits the standard button states; Close uses the app's primary treatment (accent fill with its own hover/pressed shades).

Testing

Verified in-app on Windows: slider direction under H/V flips and 90° rotations, straighten on horizons and verticals (both lean directions), badge signs matching the slider, L toggle + rebinding, saved edits unchanged. Unit tests cover the straighten math (axis snapping, both lean directions, direction-agnosticism, exact-axis no-op, ±45° bound) and a headless end-to-end drives press/drag/release through the overlay asserting emitted deltas. 103 geometry + shortcut-registry tests pass; ruff clean.

linkmodo added 2 commits July 11, 2026 23:38
Fine Rotation now reads in the photographer's convention: positive turns the
image clockwise on screen, negative counter-clockwise — under every flip state.
The sign flips at the display boundary only (slider, crop-tool angle badge,
shortcut descriptions); geometry.fine_rotation keeps the cv2/warp convention so
every saved edit renders exactly as before. Flips apply before fine rotation in
the pipeline, so the stored angle's on-screen direction is flip-independent
(verified empirically) and the single negation holds everywhere.

New Straighten tool (ruler button under Geometry > Alignment, default key L,
rebindable in Customize and listed in the shortcuts dialog): draw a reference
line on the image and it rotates to match — lines closer to horizontal level
to the horizon, lines closer to vertical plumb a building edge, drawn from
either end. A live badge previews the correction (Level/Plumb, CW-positive).
The delta is measured in display space and added to the current fine rotation
(clamped to +/-45), so it lands in the same field the slider and crop handles
drive and composes correctly under flips and 90-degree turns. One-shot like a
Lightroom straighten line; sub-8px drags are ignored, right-click never draws,
Esc cancels.
The Customize and Close buttons set widget-level stylesheets with hardcoded
backgrounds, which beat the app stylesheet in every state and killed the global
hover-grey / pressed-red feedback. Keep only the padding override so Customize
inherits the standard button states, and mark Close primary="true" so it gets
the app's accent treatment with its own hover/pressed shades, like the Export
call-to-action.
@marcinz606

Copy link
Copy Markdown
Owner

that straighten-to-line is great!

@marcinz606 marcinz606 merged commit 7f4b7a7 into marcinz606:main Jul 12, 2026
1 check passed
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