Skip to content

Commit 209b588

Browse files
committed
fix documentation for group.align -- row and column were swapped
1 parent 0c8723e commit 209b588

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/core/Group.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ Phaser.Group.prototype.updateZ = function () {
705705
*
706706
* `Group.align(-1, 8, 32, 32)`
707707
*
708-
* ... will align the children so that there are 8 columns vertically (the second argument),
708+
* ... will align the children so that there are 8 rows vertically (the second argument),
709709
* and each row will contain 6 sprites, except the last one, which will contain 5 (totaling 48)
710710
*
711711
* You can also do:
@@ -723,26 +723,26 @@ Phaser.Group.prototype.updateZ = function () {
723723
* The final argument; `offset` lets you start the alignment from a specific child index.
724724
*
725725
* @method Phaser.Group#align
726-
* @param {integer} rows - The number of rows, or width, of the grid. Set to -1 for a dynamic width.
727-
* @param {integer} columns - The number of columns, or height, of the grid. Set to -1 for a dynamic height.
726+
* @param {integer} columns - The number of columns, or width, of the grid. Set to -1 for a dynamic width.
727+
* @param {integer} rows - The number of rows, or height, of the grid. Set to -1 for a dynamic height.
728728
* @param {integer} cellWidth - The width of each grid cell, in pixels.
729729
* @param {integer} cellHeight - The height of each grid cell, in pixels.
730730
* @param {integer} [position] - The position constant. One of `Phaser.TOP_LEFT` (default), `Phaser.TOP_CENTER`, `Phaser.TOP_RIGHT`, `Phaser.LEFT_CENTER`, `Phaser.CENTER`, `Phaser.RIGHT_CENTER`, `Phaser.BOTTOM_LEFT`, `Phaser.BOTTOM_CENTER` or `Phaser.BOTTOM_RIGHT`.
731731
* @param {integer} [offset=0] - Optional index to start the alignment from. Defaults to zero, the first child in the Group, but can be set to any valid child index value.
732732
*/
733-
Phaser.Group.prototype.align = function (rows, columns, cellWidth, cellHeight, position, offset) {
733+
Phaser.Group.prototype.align = function (columns, rows, cellWidth, cellHeight, position, offset) {
734734

735735
if (position === undefined) { position = Phaser.TOP_LEFT; }
736736
if (offset === undefined) { offset = 0; }
737737

738-
if (this.children.length === 0 || offset > this.children.length || (rows === -1 && columns === -1))
738+
if (this.children.length === 0 || offset > this.children.length || (columns === -1 && rows === -1))
739739
{
740740
return;
741741
}
742742

743743
var r = new Phaser.Rectangle(0, 0, cellWidth, cellHeight);
744-
var w = (rows * cellWidth);
745-
var h = (columns * cellHeight);
744+
var w = (columns * cellWidth);
745+
var h = (rows * cellHeight);
746746

747747
for (var i = offset; i < this.children.length; i++)
748748
{
@@ -757,7 +757,7 @@ Phaser.Group.prototype.align = function (rows, columns, cellWidth, cellHeight, p
757757
continue;
758758
}
759759

760-
if (rows === -1)
760+
if (columns === -1)
761761
{
762762
// We keep laying them out horizontally until we've done them all
763763
r.y += cellHeight;
@@ -768,7 +768,7 @@ Phaser.Group.prototype.align = function (rows, columns, cellWidth, cellHeight, p
768768
r.y = 0;
769769
}
770770
}
771-
else if (columns === -1)
771+
else if (rows === -1)
772772
{
773773
// We keep laying them out vertically until we've done them all
774774
r.x += cellWidth;

0 commit comments

Comments
 (0)