Skip to content

Tokibean 码豆 0.4.5

Choose a tag to compare

@github-actions github-actions released this 13 Jul 01:26

Fix v0.4.5: pet invisible on first launch after upgrading to 0.4.4

0.4.4 shrank the default collapsed window (340 -> 255 logical px, the
new 0.75 default scale). pos_y is the window's TOP-LEFT but the pet is
drawn at the window's BOTTOM, so the shorter window lifted the pet off
its saved spot — and macOS, unlike Windows, had no on-screen clamp at
startup. A pet saved near a screen edge therefore landed off-screen and
was completely invisible. Changing the size in Settings brought it back
only because applyScale() ends with clampToScreen().

  • pet_scale becomes Option. None marks a config written before the
    size setting existed, whose position was saved against a 340px-tall
    collapsed window. On first run we migrate pos_y by the height delta so
    the pet's feet stay exactly where the user left them, then stamp the
    resolved scale.
  • macOS startup now clamps the restored position so the pet lands on a
    real monitor (picking the monitor under the pet's centre, not the
    window's top-left, since the window has transparent headroom above the
    pet; falls back to the primary monitor). Mirrors the clamp Windows has
    had. The clamped position is persisted, so we don't re-clamp an
    unreachable position on every launch.
  • Hoist the shared geometry (default scale, base/canvas sizes, window
    width) into config.rs constants so the Rust startup path and main.js
    can't drift apart.
  • applyScale() now un-hides the canvas in a finally block, so a throwing
    resize can't leave the pet permanently invisible.

Reproduced with a pre-0.4.4 config (no pet_scale, pos 2818,2124): pet
found on no display before the fix, visible after.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com