feat: add Loupe — press-and-hold magnifier (#201)#208
Open
zorange-CN wants to merge 1 commit into
Open
Conversation
…tnullname#201) Hold the Loupe hotkey (rebindable, default L) to pop up a magnifier that follows the cursor and shows the region under it at actual pixels (nearest-neighbour); release to hide. Handy for quickly confirming focus/sharpness while culling. In Compare mode the same image location is magnified on both panes at once. Behaviour: - Box size is resolution-adaptive (a fraction of the viewport short side); hold the key and use the mouse wheel to resize it live, persisted to [Controls] LoupeSizeRatio. - The cursor is hidden while active so it does not obscure the area. - Does not engage at/above 100% display scale (it would add nothing). Integration (reuses existing mechanisms): - Registered as HotkeyAction::Loupe (enum, string maps, default binding, HandleHotkeyAction dispatch, Settings > Shortcuts, GetHotkeyActionName) so it is discoverable and rebindable like every other shortcut, grouped under Zoom. - Rendered in the existing D2D dynamic overlay layer (UIRenderer::DrawLoupe): draws the same GPU-resident ID2D1Bitmap via dc->DrawBitmap, exactly like DrawResourceIntoViewport(). The cursor is mapped to an image pixel via the inverse of that same transform, so EXIF orientation and per-pane zoom/pan are handled correctly. - LoupeState in AppContext; LoupeEnabled/LoupeSizeRatio/LoupeZoom in AppConfig, persisted under [Controls]. Note: this is the project first hold-style hotkey, so activation goes through the normal key-down dispatch while a matching key-up in WndProc hides it (keyed off the registered binding, not a hardcoded key).
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.
Implements the "local zoom / loupe" item from #201.
Hold L (rebindable) to pop up a magnifier that follows the cursor and
shows the region under it at actual pixels (nearest-neighbour); release to
hide. Useful for quickly confirming focus/sharpness while culling. In
Compare mode the same image location is magnified on both panes at once.
Behaviour
hold the key and use the mouse wheel to resize it live (persisted).
Integration — reuses existing mechanisms, nothing reinvented
HotkeyAction::Loupe(enum, string maps, default binding,HandleHotkeyAction, Settings ▸ Shortcuts,GetHotkeyActionName) — fullyrebindable, grouped under "Zoom".
UIRenderer::DrawLoupe):draws the same GPU-resident
ID2D1Bitmapviadc->DrawBitmap, exactly likeDrawResourceIntoViewport(). Cursor→image mapping uses the inverse of thatsame transform, so EXIF orientation and per-pane zoom/pan are handled.
AppConfigunder[Controls](LoupeEnabled,LoupeSizeRatio,LoupeZoom).Note for review
This is the project's first hold-style hotkey, so activation goes through
the normal key-down dispatch while a matching key-up in
WndProchides it(keyed off the registered binding, not a hardcoded key). Happy to adjust the
default key, sizing, or the >100% gate if you'd prefer different defaults.
Built and tested on Windows (x64, clang-cl + LTO).