fix(shell-web): Step 3 stop-hook — pass full canvas width to host

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
`<canvas id="op" width="960">`. 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.
This commit is contained in:
Kayshen-X 2026-05-10 12:15:39 +08:00
parent b161299e88
commit 3192d237f4

View file

@ -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 `<canvas id="op" width="960">`). 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);