diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 14:01:38 +0100 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 14:01:38 +0100 |
| commit | e838bb23f8251c7b2d5b0ebfca820f38680cc022 (patch) | |
| tree | cdb1ffabde8bab8047944e83977013542320c1e8 /crates/wipfel/Cargo.toml | |
| parent | f6883fa1d586a040bf228ab886b95ca64457fa34 (diff) | |
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.
Diffstat (limited to 'crates/wipfel/Cargo.toml')
| -rw-r--r-- | crates/wipfel/Cargo.toml | 1 |
1 files changed, 1 insertions, 0 deletions
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", |
