a5b9952cbd
- 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.
48 lines
3.6 KiB
Markdown
48 lines
3.6 KiB
Markdown
# MyMistakes.md
|
||
|
||
> One task at a time. Updated before every commit touching that task: current iteration +
|
||
> why the last one failed. On task complete, committed AND pushed → truncate to this stub.
|
||
> A new task does NOT seed this file until its first failure.
|
||
|
||
## Task (active — committed `582d1f4`, NOT pushed, awaiting creator verification)
|
||
Stream widget bounding box: hug the widget on all four sides, pinned to canvas (0,0).
|
||
|
||
## Iterations that failed
|
||
1. **e917c41 — fixed 1920×1080 viewport + `Stretch="Uniform"` + startup registration.**
|
||
Failed: `Uniform` letterboxed the 16:9 canvas into arbitrary‑sized boxes → asymmetric dead
|
||
padding read as a "gap". Lesson: Fill the box with the cropped frame, never Uniform.
|
||
2. **9d4103c — per‑document CSS reset (`html/body` width/height 100%) + (0,0) anchor.**
|
||
Failed ("enlarged the gap"): forcing dimensions overrode the widget's own layout and expanded
|
||
the dead space. Lesson: inject only `overflow:hidden` + transparent background — never set sizes.
|
||
3. **8d793af — viewport == element‑box size + `Stretch="Fill"`.**
|
||
Failed (janky / truncating / scrollbars): hosting at the box size clips full‑bleed widgets to
|
||
their upper‑left chunk, and tracking the box reflows the page on drag. Lesson: render at a
|
||
fixed canvas size, never track the box.
|
||
4. **f39ebd9 — crop capture to `scrollWidth/scrollHeight` bounds + (0,0) + Fill.**
|
||
Partially passed (panel fixes 1a/1b/4 confirmed) but the box stayed loose; the apparent
|
||
"tight right/bottom" was just the small‑viewport clip edge. **ROOT CAUSE: the crop never ran.**
|
||
The script returned `JSON.stringify(...)` (a string); `ExecuteScriptAsync` JSON‑encodes every
|
||
result, so the JSON was double‑encoded → `JsonDocument.Parse` got a string node →
|
||
`GetProperty` threw → try/catch swallowed → bounds unset → no crop. Lesson: return a real JS
|
||
object, never a stringified one. Also: scroll extents ≠ widget rect (they include page margins).
|
||
5. **70fe2b8 — fixed canvas‑size viewport (1920×1080) + crop + Fill.**
|
||
Image render/resize became solid (creator confirmed) but the box still gapped right/bottom and
|
||
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 — 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 (`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. |