From 090b5e789eebbda42fa16217eb0ec333d7fe7f36 Mon Sep 17 00:00:00 2001 From: funman300 Date: Tue, 23 Jun 2026 18:59:26 -0700 Subject: [PATCH] fix(web): cap canvas via Window resize_constraints (the actual fix) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous attempts (#97/#98) capped a wrapper element's max-width and relied on the canvas's width:100% resolving against it — but winit observes and sizes the *canvas element itself* (via ResizeObserver on its content box), so the wrapper cap never reached the surface and /play still panicked at 2560x1440 on a 4K@150% viewport. Use the canonical mechanism instead: set the primary Window's `resize_constraints { max_width: 2048, max_height: 2048 }`. On web, Bevy maps this to winit `set_max_inner_size` → the canvas's own `max-width`/`max-height` style, so the wgpu surface can never exceed wgpu's downlevel_webgl2 max_texture_dimension_2d (2048). play.html mirrors the same `max-*` directly on #bevy-canvas (belt-and-suspenders) and centres the letterbox with margin:auto; the obsolete wrapper + clamp script are removed. Co-Authored-By: Claude Opus 4.8 (1M context) --- solitaire_server/web/play.html | 51 ++++++++++++---------------------- solitaire_web/src/lib.rs | 15 +++++++++- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/solitaire_server/web/play.html b/solitaire_server/web/play.html index ee7519d..50ea186 100644 --- a/solitaire_server/web/play.html +++ b/solitaire_server/web/play.html @@ -6,43 +6,28 @@ Ferrous Solitaire -
- +