Version
- Phaser Version: 4.2.1
- Operating system: N/A
- Browser: N/A
Description
The setSizeToFrame method from the Size mixin claims to accept a boolean for the frame parameter, while leaving no mention as to what passing a boolean would even do.
Moreover, attempting to pass true (a valid boolean) to the function will set the object's width/height to undefined and likely cause a crash the next time said fields are used.
To fix this, I propose 2 solutions (all of which can likely be done in tandem):
- The function should document the fact that it defaults to the current frame if the
frame parameter is omitted.
- The function's typing should be altered to change
boolean to undefined and/or make the parameter entirely optional.
Example Test Code
sprite.setSizeToFrame(false); // non obvious, uses current frame
sprite.setSizeToFrame(true); // non obvious and crashes next time sprite is used
sprite.setSizeToFrame(); // would be most ergonomic and works at runtime, but gives type errors
Additional Information
N/A
Version
Description
The
setSizeToFramemethod from theSizemixin claims to accept a boolean for theframeparameter, while leaving no mention as to what passing a boolean would even do.Moreover, attempting to pass
true(a valid boolean) to the function will set the object's width/height toundefinedand likely cause a crash the next time said fields are used.To fix this, I propose 2 solutions (all of which can likely be done in tandem):
frameparameter is omitted.booleantoundefinedand/or make the parameter entirely optional.Example Test Code
Additional Information
N/A