From e838bb23f8251c7b2d5b0ebfca820f38680cc022 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 Oct 2026 14:01:38 +0100 Subject: web: guarantee initial fit with a ResizeObserver on the canvas The fit at load time (and the 120 ms nudge) could still run before the canvas had a valid layout size, leaving the first image invisible until 'Fit to window' was pressed. A ResizeObserver attached when the first bitmap arrives fires once with the element's real size immediately after observing, then on every later resize; it re-fits automatically unless the user has panned or zoomed by hand since the last load (user_moved flag, reset on each image load). Window resizes now re-fit the image as well instead of only redrawing it. --- crates/wipfel/Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/wipfel/Cargo.toml') diff --git a/crates/wipfel/Cargo.toml b/crates/wipfel/Cargo.toml index e1e39e1..fad31ce 100644 --- a/crates/wipfel/Cargo.toml +++ b/crates/wipfel/Cargo.toml @@ -36,6 +36,7 @@ features = [ "PointerEvent", "Request", "Response", + "ResizeObserver", "TextMetrics", "Window", "WheelEvent", -- cgit v1.2.3