ab29ec801d
- FindContentBounds already trimmed the bitmap; the grid/box still rendered at the uncropped user size, so Fill stretched the tight widget into a bigger frame = dead-between-content-and-border. - ContentCanvasSize maps the crop rect to canvas units (1920/pixW per axis, DPI-correct) and the preview event now carries (bitmap, canvasW, canvasH). - OnWebView2PreviewBitmapChanged sets the element Width/Height to that size; the grid and the SelectionOverlay (both bound to the element's Width/Height) now equal the widget exactly. - IsPreviewDragging (set in MainWindow drag/resize) suppresses auto-fit mid-gesture. - Tests 10/10 (alpha bounds, canvas-size mapping incl. DPI, control size); 0 warnings.
57 lines
3.9 KiB
Markdown
57 lines
3.9 KiB
Markdown
# HANDOFF — Session State
|
||
|
||
## Branch / Commit State
|
||
|
||
**`main`**, dirty working tree being committed as one unit (web source rendering fix — user-confirmed
|
||
working). **NOT pushed — user rule: never push without explicit instruction (2026-08-24).** No feature
|
||
branches pre-1.0: all work lands on `main` per work unit.
|
||
|
||
## The web-source rendering work (2026-08-28) — CURRENT MODEL: canvas-size viewport + alpha crop + container==content
|
||
|
||
**History of failures (see MyMistakes.md for the full log):**
|
||
1. box-sized viewport clipped full-bleed widgets to their upper-left chunk → render at the master
|
||
canvas 1920×1080 (stable), the only render the creator confirmed solid.
|
||
2. `JSON.stringify` return double-encoded under `ExecuteScriptAsync` → crop silently disabled.
|
||
3. `scrollWidth/scrollHeight` at canvas size = whole viewport for full-canvas wrapper bodies → no trim.
|
||
4. DOM-element-union crop measured an unsettled layout on NavigationCompleted → BROKE the image.
|
||
5. Alpha-bbox crop (from the frame itself) fixed the BITMAP but the grid/box stayed at the uncropped
|
||
user size → Fill stretched the tight widget into a big frame → dead space between content and border.
|
||
|
||
**The CURRENT MODEL (this change):**
|
||
- `Services/WebView2Manager.cs` — page renders at 1920×1080 (stable, never tracked); `overflow:hidden`
|
||
+ transparent-bg injection. `FindContentBounds` crops the Bgra32 capture to the bounding box of
|
||
non-transparent pixels each frame (immune to timing, can never truncate content). `ContentCanvasSize`
|
||
maps the crop rect to CANVAS UNITS (DPI-correct). Preview event now carries (bitmap, canvasW, canvasH).
|
||
- `ViewModels/MainViewModel.cs` — `OnWebView2PreviewBitmapChanged` sets the element's Width/Height to
|
||
the cropped canvas size → the element grid AND the SelectionOverlay (both bound to element
|
||
Width/Height) EQUAL the widget. `IsPreviewDragging` suppresses the auto-fit during a drag gesture.
|
||
- `MainWindow.xaml.cs` — sets/clears `IsPreviewDragging` at drag/resize start and end.
|
||
- Invariant: **render at canvas size; crop to the alpha extent; SIZE THE BOX to the crop.**
|
||
- Unit tests: 10/10 (alpha bounds ×3, canvas-size mapping ×3, control size ×4).
|
||
|
||
**Property panel / sliders (2026-08-28):** web URI ✕ clears the textbox; web ✓/✕ icon buttons
|
||
`IsTabStop="False"`; Slider style `IsMoveToPointEnabled="True"`. Confirmed fixed by the creator.
|
||
|
||
Build: 0 warnings; tests 10/10. Rejected for the record: box-sized viewport, `Uniform`, CSS reset,
|
||
viewport==box, DOM-union crop (broke image), crop-without-container-size (left the gap).
|
||
|
||
## Key facts / landmines
|
||
|
||
- **App running locks `ytLive.exe`** → build fails MSB3027 until creator exits the app.
|
||
- **Startup diagnostics:** unhandled exceptions + checkpoints go to `%APPDATA%\ytLlive\startup.log`
|
||
(`Helpers/AppLog.cs`). On a silent startup crash, read that.
|
||
- **Pre-existing test failures (unrelated to web source, do not chase):**
|
||
`AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback` +
|
||
`RoundClipInteractionTests.Round_Clip_Corner_Is_Grabbable_And_Shape_Is_Circle`.
|
||
- **Real-MainWindow tests MUST set `LayoutPathOverride`** — DB pollution wiped real data once.
|
||
- **Good Dog Rule:** ONE integration test per change; no new feature branches pre-1.0.
|
||
- **Scope Lock:** declare the file list, run `scripts/scope-check.sh` before every commit.
|
||
- **Every feature change ships memory updates in the SAME commit** — `TASKS.md` status + this file.
|
||
- No `CODING.md`; conventions live in `AGENTS.md` + `ai.md`.
|
||
|
||
## Next steps
|
||
1. AWAIT creator's verdict on the container==content auto-fit — reload a widget; the selection frame
|
||
must equal the widget exactly (no dead space, including during resize). Follow-ups only if asked:
|
||
crop hysteresis for animated widgets, ticker/percent-display widgets.
|
||
2. Graceful handling of navigation errors / invalid URIs (TASK 17 ×9) — only if the creator asks.
|
||
3. Continue queue: TASK 18 local recording, TASK 21 media source, TASK 22 audio sync offset. |