Skip to content

Commit ad36418

Browse files
committed
Phaser.Matrix if passed a 0 value would consider it falsy, and replace it with the default by mistake. It now checks if the arguments are undefined or null and only then sets the defaults (thanks mmcs)
1 parent 7108bc3 commit ad36418

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
365365

366366
### Updates
367367

368-
* TypeScript definitions fixes and updates (thanks @wingyplus @monagames @marineorganism @obamor @BaroqueEngine)
368+
* TypeScript definitions fixes and updates (thanks @wingyplus @monagames @marineorganism @obamor @BaroqueEngine @danzel)
369369
* Docs typo fixes (thanks @seanirby @johnrees)
370370
* The TypeScript defs ambient declaration has been updated to make it compatible with the SystemJS loader (thanks @monagames)
371371
* You can no longer intersect check a Body against itself (thanks @VitaZheltyakov #2514)
@@ -386,6 +386,8 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
386386
* Group.addAt has been refactored to be a simple call to `Group.add`, removing lots of duplicate code in the process.
387387
* Group.create has a new optional argument `index` which controls the index within the group to insert the child to. Where 0 is the bottom of the Group. It also now makes proper use of `Group.add`, cutting down on more duplicate code.
388388
* Group.createMultiple now returns an Array containing references to all of the children that the method created.
389+
* Cache.getJSON will now return an Array if the `key` you provided points to an array instead of an Object (thanks @drhayes #2552 #2551)
390+
* Phaser.Matrix if passed a 0 value would consider it falsy, and replace it with the default by mistake. It now checks if the arguments are `undefined` or `null` and only then sets the defaults (thanks mmcs)
389391

390392
### Bug Fixes
391393

src/geom/Matrix.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
*/
2626
Phaser.Matrix = function (a, b, c, d, tx, ty) {
2727

28-
a = a || 1;
29-
b = b || 0;
30-
c = c || 0;
31-
d = d || 1;
32-
tx = tx || 0;
33-
ty = ty || 0;
28+
if (a === undefined || a === null) { a = 1; }
29+
if (b === undefined || b === null) { b = 0; }
30+
if (c === undefined || c === null) { c = 0; }
31+
if (d === undefined || d === null) { d = 1; }
32+
if (tx === undefined || tx === null) { tx = 0; }
33+
if (ty === undefined || ty === null) { ty = 0; }
3434

3535
/**
3636
* @property {number} a

0 commit comments

Comments
 (0)