Skip to content

Commit 8698a03

Browse files
committed
JSDoc fixes
1 parent 417f768 commit 8698a03

35 files changed

Lines changed: 106 additions & 133 deletions

src/tilemaps/components/FindByIndex.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
* @since 3.0.0
1616
*
1717
* @param {number} index - The tile index value to search for.
18-
* @param {number} [skip=0] - The number of times to skip a matching tile before returning.
19-
* @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the
20-
* bottom-right. Otherwise it scans from the top-left.
18+
* @param {number} skip - The number of times to skip a matching tile before returning.
19+
* @param {boolean} reverse - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left.
2120
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
2221
*
2322
* @return {?Phaser.Tilemaps.Tile} The first (or n skipped) tile with the matching index.

src/tilemaps/components/GetTileAt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var IsInLayerBounds = require('./IsInLayerBounds');
1414
*
1515
* @param {number} tileX - X position to get the tile from (given in tile units, not pixels).
1616
* @param {number} tileY - Y position to get the tile from (given in tile units, not pixels).
17-
* @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1.
17+
* @param {boolean} nonNull - If true getTile won't return null for empty tiles, but a Tile object with an index of -1.
1818
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
1919
*
2020
* @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid.

src/tilemaps/components/GetTileAtWorldXY.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ var point = new Vector2();
1717
*
1818
* @param {number} worldX - X position to get the tile from (given in pixels)
1919
* @param {number} worldY - Y position to get the tile from (given in pixels)
20-
* @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1.
21-
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
20+
* @param {boolean} nonNull - If true, function won't return null for empty tiles, but a Tile object with an index of -1.
21+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
2222
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
2323
*
24-
* @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates
25-
* were invalid.
24+
* @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid.
2625
*/
2726
var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer)
2827
{

src/tilemaps/components/HasTileAtWorldXY.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var point = new Vector2();
1818
*
1919
* @param {number} worldX - The X coordinate of the world position.
2020
* @param {number} worldY - The Y coordinate of the world position.
21-
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return.
21+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return.
2222
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
2323
*
2424
* @return {?boolean} Returns a boolean, or null if the layer given was invalid.

src/tilemaps/components/HexagonalTileToWorldXY.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ var Vector2 = require('../../math/Vector2');
1616
*
1717
* @param {number} tileX - The x coordinate, in tiles, not pixels.
1818
* @param {number} tileY - The y coordinate, in tiles, not pixels.
19-
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
20-
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
19+
* @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
20+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
2121
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
2222
*
2323
* @return {Phaser.Math.Vector2} The XY location in world coordinates.
2424
*/
2525
var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer)
2626
{
27-
if (point === undefined) { point = new Vector2(); }
27+
if (!point) { point = new Vector2(); }
2828

2929
var tileWidth = layer.baseTileWidth;
3030
var tileHeight = layer.baseTileHeight;
@@ -35,7 +35,7 @@ var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer)
3535

3636
if (tilemapLayer)
3737
{
38-
if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
38+
if (!camera) { camera = tilemapLayer.scene.cameras.main; }
3939

4040
layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX);
4141

src/tilemaps/components/HexagonalTileToWorldY.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @since 3.50.0
1313
*
1414
* @param {number} tileY - The y coordinate, in tiles, not pixels.
15-
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
15+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
1616
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
1717
*
1818
* @return {number} The Y location in world coordinates.

src/tilemaps/components/HexagonalWorldToTileXY.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,24 @@ var Vector2 = require('../../math/Vector2');
1616
*
1717
* @param {number} worldX - The x coordinate to be converted, in pixels, not tiles.
1818
* @param {number} worldY - The y coordinate to be converted, in pixels, not tiles.
19-
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinates down to the nearest integer.
20-
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
21-
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
19+
* @param {boolean} snapToFloor - Whether or not to round the tile coordinates down to the nearest integer.
20+
* @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
21+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
2222
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
2323
*
2424
* @return {Phaser.Math.Vector2} The XY location in tile units.
2525
*/
2626
var HexagonalWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer)
2727
{
28-
if (snapToFloor === undefined) { snapToFloor = true; }
29-
if (point === undefined) { point = new Vector2(); }
28+
if (!point) { point = new Vector2(); }
3029

3130
var tileWidth = layer.baseTileWidth;
3231
var tileHeight = layer.baseTileHeight;
3332
var tilemapLayer = layer.tilemapLayer;
3433

3534
if (tilemapLayer)
3635
{
37-
if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
36+
if (!camera) { camera = tilemapLayer.scene.cameras.main; }
3837

3938
// Find the world position relative to the static or dynamic layer's top left origin,
4039
// factoring in the camera's vertical scroll

src/tilemaps/components/HexagonalWorldToTileY.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,20 @@
1212
* @since 3.50.0
1313
*
1414
* @param {number} worldY - The y coordinate to be converted, in pixels, not tiles.
15-
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
16-
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
15+
* @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer.
16+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
1717
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
1818
*
1919
* @return {number} The Y location in tile units.
2020
*/
2121
var HexagonalWorldToTileY = function (worldY, snapToFloor, camera, layer)
2222
{
23-
if (snapToFloor === undefined) { snapToFloor = true; }
24-
2523
var tileHeight = layer.baseTileHeight;
2624
var tilemapLayer = layer.tilemapLayer;
2725

2826
if (tilemapLayer)
2927
{
30-
if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
28+
if (!camera) { camera = tilemapLayer.scene.cameras.main; }
3129

3230
// Find the world position relative to the static or dynamic layer's top left origin,
3331
// factoring in the camera's vertical scroll

src/tilemaps/components/IsometricTileToWorldXY.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ var Vector2 = require('../../math/Vector2');
1616
*
1717
* @param {number} tileX - The x coordinate, in tiles, not pixels.
1818
* @param {number} tileY - The y coordinate, in tiles, not pixels.
19-
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
20-
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
19+
* @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
20+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
2121
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
2222
*
2323
* @return {Phaser.Math.Vector2} The XY location in world coordinates.
2424
*/
2525
var IsometricTileToWorldXY = function (tileX, tileY, point, camera, layer)
2626
{
27-
if (point === undefined) { point = new Vector2(); }
27+
if (!point) { point = new Vector2(); }
2828

2929
var tileWidth = layer.baseTileWidth;
3030
var tileHeight = layer.baseTileHeight;
@@ -35,7 +35,7 @@ var IsometricTileToWorldXY = function (tileX, tileY, point, camera, layer)
3535

3636
if (tilemapLayer)
3737
{
38-
if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
38+
if (!camera) { camera = tilemapLayer.scene.cameras.main; }
3939

4040
layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX);
4141

src/tilemaps/components/IsometricWorldToTileXY.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,24 @@ var Vector2 = require('../../math/Vector2');
1616
*
1717
* @param {number} worldX - The x coordinate to be converted, in pixels, not tiles.
1818
* @param {number} worldY - The y coordinate to be converted, in pixels, not tiles.
19-
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
20-
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
21-
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
19+
* @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer.
20+
* @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
21+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
2222
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
2323
*
2424
* @return {Phaser.Math.Vector2} The XY location in tile units.
2525
*/
2626
var IsometricWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer)
2727
{
28-
if (snapToFloor === undefined) { snapToFloor = true; }
29-
if (point === undefined) { point = new Vector2(); }
28+
if (!point) { point = new Vector2(); }
3029

3130
var tileWidth = layer.baseTileWidth;
3231
var tileHeight = layer.baseTileHeight;
3332
var tilemapLayer = layer.tilemapLayer;
3433

3534
if (tilemapLayer)
3635
{
37-
if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
36+
if (!camera) { camera = tilemapLayer.scene.cameras.main; }
3837

3938
// Find the world position relative to the static or dynamic layer's top left origin,
4039
// factoring in the camera's vertical scroll

0 commit comments

Comments
 (0)