Web source: stable viewport (snapshot at register) + Stretch=Fill + overflow:hidden — no reflow, no scrollbars, no dead space

This commit is contained in:
2026-08-28 10:56:23 -07:00
parent 8d793af91a
commit 23874c2dd6
4 changed files with 44 additions and 66 deletions
+11 -9
View File
@@ -917,15 +917,17 @@ capturing the primary display (which causes the infinity mirror effect).
8. ✅ Preview shows live web content (not just a blank rectangle)
9. ☐ Handle navigation errors, invalid URIs, timeout gracefully
**Rendering model (2026-08-28, geometry-agnostic — supersedes the earlier fixed-viewport model):**
the WebView2 viewport IS the element box (`Source.Width × Source.Height`); the page renders at
exactly the box size and the captured frame is displayed with `Stretch="Fill"`, so the selection
rect always bounds the actual rendered content — no fixed render size, no aspect assumptions,
no dead space/padding for any widget geometry. A `PropertyChanged` hook keeps the viewport
locked to the box; capture is re-triggered on resize. Graceful-error handling (item 9) is a
follow-up. Earlier attempts for the record: (a) fixed 1920×1080 viewport + `Stretch="Uniform"`
fixed the truncation but left box-vs-content gaps (box aspect ≠ capture aspect); (b) CSS reset
injection made gaps larger (belayed by creator).
**Rendering model (2026-08-28, stable-viewport + fill — the working invariant):**
the page renders ONCE at the size the element was created at (snapshot in `Register`, never
tracked) — so dragging the box never reflows the page, never truncates it, and scrollbars are
suppressed (`overflow:hidden` on html/body injection; background-transparent only otherwise,
no layout meddling). The captured texture is displayed with `Stretch="Fill"`, so any box the
user draws is covered edge-to-edge with zero dead space (OBS free-transform behavior:
browser renders at a fixed resolution, the scene-item scales the texture). The invariants:
the page viewport is stable; the display Fill-scales it to the box. Graceful-error handling
(item 9) is a follow-up. Attempts rejected for the record: fixed 1920×1080 + `Uniform`
(letterbox dead space), CSS margin/100% reset (enlarged the gap), viewport==box (page reflow
→ truncation/scrollbars/jank).
### Design decisions