Skip to content

feat: add Loupe — press-and-hold magnifier (#201)#208

Open
zorange-CN wants to merge 1 commit into
justnullname:mainfrom
zorange-CN:feature/focus-loupe
Open

feat: add Loupe — press-and-hold magnifier (#201)#208
zorange-CN wants to merge 1 commit into
justnullname:mainfrom
zorange-CN:feature/focus-loupe

Conversation

@zorange-CN

Copy link
Copy Markdown

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

  • Box size is resolution-adaptive (a fraction of the viewport's short side);
    hold the key and use the mouse wheel to resize it live (persisted).
  • Cursor is hidden while active so it doesn't obscure the area.
  • Doesn't engage at/above 100% display scale (it would add nothing).

Integration — reuses existing mechanisms, nothing reinvented

  • Registered as HotkeyAction::Loupe (enum, string maps, default binding,
    HandleHotkeyAction, Settings ▸ Shortcuts, GetHotkeyActionName) — fully
    rebindable, 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(). Cursor→image mapping uses the inverse of that
    same transform, so EXIF orientation and per-pane zoom/pan are handled.
  • Settings in AppConfig under [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 WndProc hides 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).

…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).
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.

1 participant