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

CanvasTexture: width and height are not updated after a setSize() #5054

Closed
sebbernery opened this issue Mar 24, 2020 · 1 comment
Closed

Comments

@sebbernery
Copy link

Version

  • Phaser Version: 3.22
  • Operating system: Ubuntu 19.10
  • Browser: Firefox

Description

When you call setSize() on a CanvasTexture, the canvas is resized but the width and height attributes of the CanvasTexture are not updated.

Example Test Code

Here is an example on jsbin: https://jsbin.com/jusasaroce/

Additional Information

Here is an example of the issue I get with bad width and height values on canvasTexture after a resize.
Capture d’écran de 2020-03-24 09-28-47

In my code, I set manually canvas_texture.width and canvas_texture.height to the new value and it solves the problem. Here (resize source code) you can see that this.width and this.height are never changed (and it's not done in refresh). I post an issue instead of a pull request because I'm not confident enough about any side effect that can happend but I guess the solution would be add this.width = width and this.height = height before the refresh call.

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

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

No branches or pull requests

2 participants