Skip to content

Conversation

@VijayVPatil13
Copy link

@VijayVPatil13 VijayVPatil13 commented Nov 24, 2025

This PR fixes issue #7213 where the ScaleManager fails to resize the game canvas
to match the size of its parent container.

Root Cause:
The window resize handler only updated canvas bounds, but did not re-measure the
parent container size. As a result, the Scale Manager used outdated parent size
values, causing the canvas to display incorrectly after window resize or mobile
orientation changes.

Fix:

  • Added getParentBounds() and refresh() inside listeners.windowResize.
  • Ensures the parent container size is always recalculated.
  • Forces Phaser to re-run scale calculations using correct parent bounds.

Tested:

  • Browser window resize (Chrome, Edge)
  • CSS-driven container resizing
  • Mobile device orientation change
  • RESIZE and FIT scale modes

Result:
The canvas now consistently fills the parent container without clipping,
shifting, or leaving empty space.

This resolves #7213.


Note

On window resize, recalculate parent bounds and refresh scaling so the canvas correctly resizes to its parent.

  • ScaleManager (src/scale/ScaleManager.js):
    • Window resize listener now recalculates parent bounds and forces a scale refresh:
      • Calls getParentBounds() and refresh() inside listeners.windowResize after updateBounds() to ensure canvas resizes to current parent size.

Written by Cursor Bugbot for commit 108e196. This will update automatically on new commits. Configure here.

@VijayVPatil13
Copy link
Author

Thank you for reviewing the PR. Please let me know if any changes are needed.

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.

Scale Manager fails to resize to full container

1 participant