Skip to content

fix: pause menu buttons unresponsive when camera has scrolled - #65

Merged
linkbag merged 1 commit into
mainfrom
feat/ic-pause-menu-fix
Mar 9, 2026
Merged

linkbag merged 1 commit into
mainfrom
feat/ic-pause-menu-fix

Conversation

@linkbag

@linkbag linkbag commented Mar 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Root cause: Container.setScrollFactor(0) does not propagate to children (updateChildren=false by default in Phaser 3). The interactive bg Rectangle inside each pause button retained scrollFactorX=1.
  • Effect: InputManager.hitTest() computes hit points as px = pointer.x + (csx * scrollFactorX) - csx. With scrollFactorX=1 and any camera scroll (csx > 0), the hit area is displaced off-screen — clicks never register. Visually buttons appeared correct because the WebGL renderer applies the container's scroll factor temporarily during rendering.
  • Fix: Added .setScrollFactor(0) to bg (interactive Rectangle) and txt inside createPauseButton(). This applies to all pause panel buttons: Resume, Return to Setup, Return to Menu, Cancel, Quit Match.

Test plan

  • npx tsc --noEmit — clean
  • npx vitest run — 96/96 passing
  • Manual: start a skirmish, scroll camera away from (0,0), press ESC — all pause menu buttons clickable

🤖 Generated with Claude Code

Phaser Container.setScrollFactor(0) does not propagate to children by
default (updateChildren=false). The interactive bg Rectangle inside each
pause button retained scrollFactorX=1. InputManager.hitTest() computes
hit points as px = pointer.x + (csx * scrollFactorX) - csx, so with
scrollFactorX=1 the hit area was displaced by the camera scroll amount.

Fix: add .setScrollFactor(0) to bg and txt in createPauseButton() so
input hit-testing uses screen coordinates, matching the visual position.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linkbag
linkbag merged commit 6a6fb8d into main Mar 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant