Web source: stable viewport (snapshot at register) + Stretch=Fill + overflow:hidden — no reflow, no scrollbars, no dead space
This commit is contained in:
+16
-24
@@ -6,34 +6,26 @@
|
||||
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: viewport == element box
|
||||
## The web-source rendering work (2026-08-28) — CURRENT MODEL: stable viewport + Fill
|
||||
|
||||
**Background:** the fixed-viewport fix (1920×1080 control + `Stretch="Uniform"`) made the page
|
||||
render without truncation but left dead space between the selection box and the content (box
|
||||
aspect ≠ capture aspect → letterbox; box is sized by the parent layout, capture is a separate
|
||||
hardcoded viewport — they bind to different rects). A CSS-reset experiment made the gap worse
|
||||
and was shelved by the creator. He stressed the systems must be GEOMETRY-AGNOSTIC: no 16:9,
|
||||
no fixed render size, no per-widget assumptions.
|
||||
**Background:** viewport==box made dragging the box reflow the page (truncation, scrollbars,
|
||||
unrecoverable image, "janky at stressful geometries"). Fixed-viewport + `Uniform` left letterbox
|
||||
dead space. CSS reset enlarged the gap. Scrollbars were called "super fail".
|
||||
|
||||
**The model that delivers it (implemented, needs visual verification):**
|
||||
- `Services/WebView2Manager.cs` — the WebView2 viewport IS the element box
|
||||
(`Source.Width × Source.Height`). The page renders at exactly the box size; a `PropertyChanged`
|
||||
hook keeps the viewport locked to the box (re-triggers capture on resize, sub-0.5px drift is
|
||||
ignored). `CaptureFrame` is unchanged (aspect-preserving Physical-size capture).
|
||||
- `MainWindow.xaml` — web `<Image>` uses `Stretch="Fill"` (capture aspect == box aspect by
|
||||
construction, so Fill == Uniform with zero dead space; during a transient stale frame it just
|
||||
holds aspect briefly). Everything else still `UniformToFill`.
|
||||
- Selection rect == content rect by construction → flush edges, no padding, works for any widget
|
||||
geometry the creator throws at it. FramePump still reads `GetLatestFrame` via `ResolveOutputFrame`.
|
||||
- Transparent-background JS injection retained (background only — no layout/CSS-reset meddling).
|
||||
**The model that satisfies invariants (implemented, needs visual verification):**
|
||||
- `Services/WebView2Manager.cs` — the page renders ONCE at the viewport size the element was
|
||||
created at (snapshot in `Register`, never tracked → no reflow, no truncation during resize).
|
||||
`overflow:hidden` (html+body) + transparent-bg injection on every nav — nothing else, no
|
||||
layout/CSS meddling. Immediate capture on `NavigationCompleted`. `FramePump` unchanged.
|
||||
- `MainWindow.xaml` — web `<Image>` uses `Stretch="Fill"`: any box the user draws is covered
|
||||
edge-to-edge, zero dead space, zero crop (OBS free-transform: fixed browser resolution,
|
||||
scene-item scales the texture). Aspect distortion only when the box aspect ≠ viewport aspect.
|
||||
- Invariants: **page viewport is stable; display Fill-scales texture to the box.**
|
||||
|
||||
Build: 0 warnings; WebView2Manager tests 4/4 (size tracks source, sub-pixel drift ignored,
|
||||
minimum 1, transparent bg).
|
||||
Build: 0 warnings; tests 4/4 (snapshot at register, no tracking after, min 1, transparent bg).
|
||||
|
||||
**Landmines (earlier attempts — do not repeat):** fixed-viewport (letterbox dead space),
|
||||
CSS reset/margin juggling (enlarged the gap), control-tracking-box combined with
|
||||
`UniformToFill` display (truncation), ZoomFactor meddling. The working invariant is:
|
||||
**viewport rect == selection rect, display = Fill.**
|
||||
**Rejected for the record:** fixed 1920×1080+`Uniform` (letterbox), CSS margin/100% reset
|
||||
(enlarged gap), viewport==box (reflow/truncation/scrollbars).
|
||||
|
||||
## Key facts / landmines
|
||||
|
||||
|
||||
Reference in New Issue
Block a user