Web source: crop to the WIDGET rect (visible-element union excluding full-viewport wrappers) — kills the ghost-boundary dead space

- scrollWidth/scrollHeight returns the whole 1920x1080 canvas for widgets whose body/background
  spans it, so the crop kept massive transparent margins and the content floated in the Fill box.
- ContentBoundsScript now unions every visible element's getBoundingClientRect, excluding elements
  that span >=98% of the viewport (bodies, full-canvas background layers); full-bleed widgets fall
  back to the full rect. Crop taken AT the rect's top-left (l,t) — content pins to bitmap (0,0).
- Web Image explicitly Margin=0 + Left/Top alignment so the frame and widget coincide at the origin.
- Canvas-size render untouched.
This commit is contained in:
2026-08-28 11:45:31 -07:00
parent b862a0fb04
commit a5b9952cbd
4 changed files with 82 additions and 36 deletions
+15 -11
View File
@@ -30,15 +30,19 @@ Stream widget bounding box: hug the widget on all four sides, pinned to canvas (
wasn't 0,0. Same silent JSON bug — the crop still never executed — and the measure was scroll
extents regardless. Lesson: verify declared mechanics actually execute; assume nothing ran.
## Current iteration (web bounding box — committed, NOT pushed, verification pending)
- Render stays the confirmed-solid 1920×1080 canvas-size viewport + `Stretch="Fill"` (UNTOUCHED).
- Crop BEHAVIOR restored to f39ebd9 exactly: capture cropped from (0,0) to
`scrollWidth/scrollHeight` extents — the code that nailed right/bottom. Real-object return
keeps the crop actually executing (past cause: JSON.stringify double-encode silently disabled it).
## Current iteration (web bounding box — UNCOMMITTED, verification pending)
Render stays the confirmed-solid 1920×1080 canvas-size viewport + `Stretch="Fill"` (UNTOUCHED).
Crop now uses the WIDGET rect, not scroll extents: union of every visible element's
`getBoundingClientRect`, EXCLUDING elements spanning ≥98% of the viewport (bodies,
full-canvas background layers — they are wrappers, not content). Crop is taken AT the
rect's top-left (l,t) so content pins to bitmap (0,0). Web Image explicitly
`Margin="0"` + `HorizontalAlignment="Left"`/`VerticalAlignment="Top"`.
## Iteration that just failed (`582d1f4` — union of every `body *` element rect)
Gap moved to ALL sides. The union includes invisible full-canvas layout wrappers, so the crop rect
came out larger than the visible widget; the offset crop (+ Rewatched fills from a subset of the
canvas. Over-engineering: the fix that already worked was f39ebd9's simple scroll-extents crop.
Creator's instruction: go back to that code. DONE — do not re-introduce element-union measuring.
Lesson: when a prior iteration is declared good, REVERT TO IT; do not build a cleverer replacement.
## Iteration that just failed (`b862a0f` — reverted to f39ebd9's scrollWidth/Height crop)
Creator still saw a massive "ghost" frame around the visible widget. Root cause: for widgets
whose body/background spans the full 1920×1080 canvas, `scrollWidth/scrollHeight` returns the
WHOLE viewport → the crop keeps massive transparent margins → dead space inside the bitmap →
content floats inside the Fill-stretched box. So the earlier "nailed right/bottom" (f39ebd9) was
only right for box-sized viewports: at the canvas size, scroll extents == viewport for full-canvas
wrappers. Lesson: never trust scrollWidth/scrollHeight at canvas-size render; measure visible
content and exclude full-viewport wrappers/backgrounds.