Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BitmapMask scaling incorrectly when game size is set manually #6531

Closed
crockergd opened this issue Jun 21, 2023 · 2 comments
Closed

BitmapMask scaling incorrectly when game size is set manually #6531

crockergd opened this issue Jun 21, 2023 · 2 comments

Comments

@crockergd
Copy link

Version

  • Phaser Version: 3.60.beta-19+
  • Operating system: Windows + Android
  • Browser:

Description

Applying a BitmapMask in a game that uses the FIT scale mode and sets game size manually (to handle DPR scaling on mobile) no longer works correctly as of 3.60.0-beta.19. Any texture that a BitmapMask is applied to appears to scale and transform based on the manually set game size (game size * DPR) and not the final game size the FIT scaling mode enforces to stay within the window.

Example Test Code

https://codepen.io/crockergd/pen/abQmyvL

Functioning correctly, the demo should display a large grey square in the middle of the canvas being masked by a red stripe through the middle. This can be seen by setting the Phaser dependency to https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.min.js or earlier. Using any dependency of 3.60.0-beta.19 or later causes the grey square to scale and transform as if the canvas was larger, but the mask texture to remain in the correct spot and still mask off parts of the grey square as if it was correctly placed.

Additional Information

I've set the game size scaling in the demo to be 1.5, but this affects any scaling above 1.

Rescaling textures or masks to account for this new behaviour cannot resolve the issue, it's challenging to demonstrate in a codepen but the cropping functionality of the mask (the section clipped out) cannot be scaled in any way I can find. This makes masks of complex shapes no longer viable. Neither scaling the original texture used to create the mask, nor the masked texture itself seems to affect this.

@neki-dev
Copy link
Contributor

neki-dev commented Jul 4, 2023

I have same problem, but on sprites with shaders.
For example: https://www.veed.io/view/c5e8269f-785e-46c1-8c05-a62eba83aeed?panel=share
On resize screen - sprite without shader scaling normal, but with shader i get incorrect scaling.

@photonstorm
Copy link
Collaborator

Thanks for opening this, but it's a duplicate of #6527 (which itself is sort of a duplicate of #6503) so am tagging them here for completeness, but closing this as it needs tracking in the older issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants