From 3192d237f4b418c2895ca56e93b1cfb04410455b Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Sun, 10 May 2026 12:15:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(shell-web):=20Step=203=20stop-hook=20?= =?UTF-8?q?=E2=80=94=20pass=20full=20canvas=20width=20to=20host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex stop-hook flagged: "web smoke paints only the toolbar". Root cause: shell-web's `paint_inspector` still passed the Step 1b leftover `280.0` to `host.paint`, but Step 3's WidgetHost layout takes ~1/4 width per rail. With viewport_width=280 the rail_w computation: rail_w = ((280.0 / 4.0) - 8.0).min(240.0).max(0.0) = 62.0 falls below MIN_RAIL_WIDTH (80), so the host's early-return silently fired and only the toolbar painted. The smoke HTML canvas is 960×640 — the host was getting a synthetic viewport that didn't reflect reality. Fix: pass `960.0` to `host.paint`, matching the smoke HTML's ``. Now LayerPanel + CanvasViewport + PropertyPanel all paint into the canvas. Inline comment cites the codex finding so a future hardcoded viewport width regression is obvious. Bundle untouched at 624 474 bytes gzip / 0 env.* imports. --- crates/openpencil-shell-web/src/lib.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/openpencil-shell-web/src/lib.rs b/crates/openpencil-shell-web/src/lib.rs index 62b5fe712..76abc24bf 100644 --- a/crates/openpencil-shell-web/src/lib.rs +++ b/crates/openpencil-shell-web/src/lib.rs @@ -118,8 +118,17 @@ impl Inner { }, Color::WHITE, ); - // Inspector slice: 280 px wide column on the left. - self.host.paint(&mut self.backend, 280.0); + // Step 3: pass the FULL canvas width (matches the smoke + // HTML's ``). The host's + // `paint(&self, backend, viewport_width)` lays out + // Toolbar-top + LayerPanel-left + CanvasViewport-center + // + PropertyPanel-right; viewport_width below the + // MIN_RAIL_WIDTH cutoff would silently skip everything + // except the toolbar — codex stop-hook + // "web smoke paints only the toolbar" caught this when + // the leftover Step 1b 280-px hardcode was still in + // place. + self.host.paint(&mut self.backend, 960.0); self.backend.end_frame(); if let Some(err) = self.backend.take_present_error() { return Err(err);