Repository navigation
fix: pause menu buttons unresponsive when camera has scrolled - #65
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Container.setScrollFactor(0)does not propagate to children (updateChildren=falseby default in Phaser 3). The interactivebgRectangle inside each pause button retainedscrollFactorX=1.InputManager.hitTest()computes hit points aspx = pointer.x + (csx * scrollFactorX) - csx. WithscrollFactorX=1and 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..setScrollFactor(0)tobg(interactive Rectangle) andtxtinsidecreatePauseButton(). This applies to all pause panel buttons: Resume, Return to Setup, Return to Menu, Cancel, Quit Match.Test plan
npx tsc --noEmit— cleannpx vitest run— 96/96 passing🤖 Generated with Claude Code