Repository navigation
Windows/Linux: keep Mochi whole after a monitor change - #892
Conversation
The canvas bitmaps were sized once for the pixel ratio of the monitor the window started on, but drawn at the current one: moved to a monitor with another scale, Mochi came out too big and cut (or too small). The island's Mochi, the greeting, the mini Mochis, the desktop Mochi and the wardrobe icons now resize their bitmap when the ratio changes. The resolution media query was made once, for the first ratio: after one change it never fired again, so the zoom correction missed the next monitor. It now re-arms itself after every change, and wakes the island's frame loop so Mochi is redrawn at once, even while idle.
|
Hi Louis 👋 — this is the first of eight pull requests from the Windows work in my fork. Each one is a single topic, built on today's Fixes and robustness
New feature
Look and feel — these change how existing views behave, which CLAUDE.md leaves to you, so they are proposals:
Two pairs touch the same lines (#892/#899, #894/#895): whichever lands second needs a trivial rebase, and I'll do it. I'd be glad if you'd consider them for Coucou, and happy to change anything you'd like done differently. Thanks for Coucou and Mochi! |
|
Tested on real hardware: Windows 11 Pro 26H2, RTX 3090, two monitors at different scales: a 3840×2160 at 150 % (main) and a 1440×2560 portrait at 100 % next to it. Debug build of
So the "not re-checked by hand across the real monitors" part is covered now 🙂 This also fixes the same bug as my #809 (desktop Mochi cut off after a scale change, #344), and covers more (island Mochi, minis, wardrobe, the media query that only fired once). @Louis-CFM if you take this one, I'm happy to close #809 in its favour. |
) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
…tatuses Brings in keeping Mochi whole after a monitor change (Louis-CFM#892). The WhatsApp fix (Louis-CFM#901) was written for the update's own WhatsApp, which this branch leaves out; the same check is ported to this branch's WhatsApp instead: Status updates, broadcast lists and channels no longer become chats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moving the island (or the desktop Mochi) to a monitor with a different scale could leave Mochi drawn too big and cut off, until something made him change size.
How to reproduce: two monitors at different scales (say 100 % and 150 %), Island lives on: the screen under the cursor, move the cursor to the other monitor with the island open. Mochi comes out too big and cut (or too small going the other way); it heals only when he changes size (compact ↔ expanded).
Cause
drawBotonly resized the bitmap when Mochi's size changed, never when the ratio did.(resolution: Ndppx)media query inmain.tswas created once for the first ratio: after one change it never fired again, so the zoom correction missed every later monitor change.Changes
island.ts: Mochi's canvas resizes when the ratio changes, not only his size; the greeting canvas too.desktop/main.ts,mochi/minibots.ts,views/wardrobe.ts: the desktop Mochi, the mini Mochis and the wardrobe icons follow the ratio the same way (the upload canvas, the pill and the Coucou window already did).main.ts: the ratio watcher re-arms itself after every change, and wakes the island's frame loop so Mochi is redrawn at once even while idle (the loop stops when nothing moves).screen-changedwakes it too.Validation
npm test: 466 passed.tsc --noEmit,vite build: passed.git diff --check: passed.Emulated scale changes don't fire media-query
changeevents in Chromium, so the watcher re-arming itself is covered by reading, not by that test;screen-changedwaking the loop is the second path for the same redraw. #899 (island screen hop) wraps the samescreen-changedhandler: whichever lands second needs a one-line merge.