Skip to content

Commit f8c4252

Browse files
committed
Tweaked setTileScale arguments
1 parent 916a13c commit f8c4252

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Version 3.17.0 - Togusa - in development
44

5+
### Updates
6+
7+
* `TileSprite.setTileScale` has been updated so that the `y` argument is optional and set to match the `x` argument, like `setScale` elsewhere in the API.
8+
59
### Bug Fixes
610

711
* The `Mesh.setAlpha` method has been restored, even though it's empty and does nothing, to prevent runtime errors when adding a Mesh or Quad object to a Container. Fix #4338 #4343 (thanks @pfdtravalmatic @charmingny)

src/gameobjects/tilesprite/TileSprite.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,22 +376,18 @@ var TileSprite = new Class({
376376
* @method Phaser.GameObjects.TileSprite#setTileScale
377377
* @since 3.12.0
378378
*
379-
* @param {number} [x] - The horizontal scale of the tiling texture.
380-
* @param {number} [y] - The vertical scale of the tiling texture.
379+
* @param {number} [x] - The horizontal scale of the tiling texture. If not given it will use the current `tileScaleX` value.
380+
* @param {number} [y=x] - The vertical scale of the tiling texture. If not given it will use the `x` value.
381381
*
382382
* @return {this} This Tile Sprite instance.
383383
*/
384384
setTileScale: function (x, y)
385385
{
386-
if (x !== undefined)
387-
{
388-
this.tileScaleX = x;
389-
}
386+
if (x === undefined) { x = this.tileScaleX; }
387+
if (y === undefined) { y = x; }
390388

391-
if (y !== undefined)
392-
{
393-
this.tileScaleY = y;
394-
}
389+
this.tileScaleX = x;
390+
this.tileScaleY = y;
395391

396392
return this;
397393
},

0 commit comments

Comments
 (0)