Clockwise-positive fine rotation + Straighten reference-line tool#460
Merged
marcinz606 merged 2 commits intoJul 12, 2026
Merged
Conversation
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.
Owner
|
that straighten-to-line is great! |
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.
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+Rshortcut descriptions follow the same convention.The sign flips at the display boundary only;
geometry.fine_rotationkeeps 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.
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
primarytreatment (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,
Ltoggle + 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.