Files
kniip/.cursor/plans/vergrootglas_bij_selectie_eaef4448.plan.md
T
rogierandCursor 6d19b91963 1.1.5
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-09 17:32:50 +01:00

66 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: Vergrootglas bij selectie
overview: Add a magnifier (circular zoom with crosshair and X/Y coordinates near the cursor) to the snip overlay and the screencast region selector, with a settings checkbox that is on by default. Release as 1.1.5.
todos:
- id: setting
content: ShowMagnifier (default true) toevoegen aan AppSettings
status: completed
- id: control
content: "MagnifierControl maken: ronde zoom, raster, kruisdraad, X/Y-badge, plaatsing bij cursor met randcorrectie"
status: completed
- id: snip
content: Vergrootglas in RegionCaptureWindow + doorgeven vanuit App.BeginSnip
status: completed
- id: screencast
content: Vergrootglas in RegionSelectorWindow met vooraf vastgelegd beeld vanuit RecordingController.BeginSelection
status: completed
- id: settings-ui
content: Checkbox in SettingsWindow (tab Sneltoetsen) laden en opslaan
status: completed
- id: release
content: CHANGELOG 1.1.5, README, versienummers, build.ps1 draaien, commit/tag 1.1.5 en pushen
status: completed
isProject: false
---
# Vergrootglas bij het kiezen van een gebied (1.1.5)
## Starting point
- kniip has no magnifier yet. The snip overlay [src/Kniip/Capture/RegionCaptureWindow.xaml](src/Kniip/Capture/RegionCaptureWindow.xaml) shows a frozen screenshot (`Frozen`), a dim layer, the selection and a `W × H` badge.
- The screencast selector [src/Kniip/Recording/RegionSelectorWindow.xaml](src/Kniip/Recording/RegionSelectorWindow.xaml) is a transparent overlay over the live screen. It has no image to zoom into.
## Approach
```mermaid
flowchart LR
Settings["AppSettings.ShowMagnifier"] --> App["App.BeginSnip"]
Settings --> Rec["RecordingController.BeginSelection"]
App -->|"frozen image + flag"| Snip[RegionCaptureWindow]
Rec -->|"capture per screen + flag"| Sel[RegionSelectorWindow]
Snip --> Mag[MagnifierControl]
Sel --> Mag
```
1. **Setting**: in [src/Kniip/Settings/AppSettings.cs](src/Kniip/Settings/AppSettings.cs) add
`public bool ShowMagnifier { get; set; } = true;` with a Dutch doc comment.
2. **Shared control**: new `src/Kniip/Capture/MagnifierControl.xaml(.cs)` (UserControl, `IsHitTestVisible="False"`), styled like the screenshot:
- A round clipped area (about 130 DIP) showing an `Image` of the frozen bitmap with `NearestNeighbor` scaling. A `CroppedBitmap` of about 15x15 physical pixels around the cursor is enlarged around 8x.
- A pixel grid, a blue crosshair through the center pixel and a small square on the center pixel. The crosshair uses `AccentBrush`, the ring is white with a shadow.
- Below the circle, a badge in the same style as `SizeBadge` with `X: … Y: …` in physical screen coordinates.
- Method `Update(BitmapSource frozen, System.Drawing.Point physicalRelative, System.Drawing.Point screenPoint)`. Pixels outside the image are left black.
- Placement: bottom-right of the cursor at about 20 DIP offset. It flips left and/or up near the screen edge.
3. **Snip overlay** [src/Kniip/Capture/RegionCaptureWindow.xaml.cs](src/Kniip/Capture/RegionCaptureWindow.xaml.cs):
- Add a constructor parameter `bool showMagnifier` and add `<local:MagnifierControl x:Name="Magnifier" Visibility="Collapsed"/>` to the Grid.
- In `OnMouseMove`, update and show the magnifier while it is on (before and during dragging). Not in window-pick mode (`PicksWindow`), because exact pixels don't matter there. Hide it on `MouseLeave`.
- [src/Kniip/App.xaml.cs](src/Kniip/App.xaml.cs) `BeginSnip` passes `Settings.ShowMagnifier`.
4. **Screencast selector** [src/Kniip/Recording/RegionSelectorWindow.xaml.cs](src/Kniip/Recording/RegionSelectorWindow.xaml.cs):
- Add an optional `BitmapSource? frozen` constructor parameter. When it is set, the same magnifier runs in `OnMouseMove` (also while hovering over windows, because you can drag from there).
- [src/Kniip/Recording/RecordingController.cs](src/Kniip/Recording/RecordingController.cs) `BeginSelection`: if `_settings.ShowMagnifier` is on, call `ScreenGrabber.Capture(screen.Bounds)` per screen *before* the selectors are shown, so the overlay is not in the image. Otherwise pass `null`.
5. **Settings screen** [src/Kniip/Settings/SettingsWindow.xaml](src/Kniip/Settings/SettingsWindow.xaml) tab **Sneltoetsen**: below the hotkeys, add a card title "Gebied kiezen" with
`<CheckBox x:Name="MagnifierBox" Content="Vergrootglas tonen bij het kiezen van een gebied (knipsel en screencast)" />`.
In [SettingsWindow.xaml.cs](src/Kniip/Settings/SettingsWindow.xaml.cs), add a line to `LoadFrom` (around line 100) and to the save step (around line 444).
6. **Release 1.1.5**:
- [CHANGELOG.md](CHANGELOG.md) gets a new section `## 1.1.5 - 2026-11-09` with a **Nieuw** entry for the magnifier (round zoom with crosshair and X/Y, for both snips and screencasts) and how to turn it off.
- [README.md](README.md): the version table and build comment go to 1.1.5.
- Version 1.1.4 becomes 1.1.5 in [build.ps1](build.ps1), [installer/Kniip.iss](installer/Kniip.iss) and [src/Kniip/Kniip.csproj](src/Kniip/Kniip.csproj).
- Run `.\build.ps1`, then commit "1.1.5", tag `1.1.5` and push, the same way as 1.1.4. You create the release on git.hibbit.net yourself; I'll supply the changelog text.