mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Fixed JSDocs
This commit is contained in:
parent
78b75efb8c
commit
c5d7c94cb4
2 changed files with 8 additions and 16 deletions
|
@ -12,22 +12,20 @@
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} worldX - The x coordinate to be converted, in pixels, not tiles.
|
||||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
*
|
||||
* @return {number} The X location in tile units.
|
||||
*/
|
||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer)
|
||||
{
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
|
||||
if (tilemapLayer)
|
||||
{
|
||||
if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
|
||||
if (!camera) { camera = tilemapLayer.scene.cameras.main; }
|
||||
|
||||
// Find the world position relative to the static or dynamic layer's top left origin,
|
||||
// factoring in the camera's horizontal scroll
|
||||
|
@ -36,9 +34,7 @@ var WorldToTileX = function (worldX, snapToFloor, camera, layer)
|
|||
tileWidth *= tilemapLayer.scaleX;
|
||||
}
|
||||
|
||||
return snapToFloor
|
||||
? Math.floor(worldX / tileWidth)
|
||||
: worldX / tileWidth;
|
||||
return (snapToFloor) ? Math.floor(worldX / tileWidth) : worldX / tileWidth;
|
||||
};
|
||||
|
||||
module.exports = WorldToTileX;
|
||||
|
|
|
@ -12,22 +12,20 @@
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} worldY - The y coordinate to be converted, in pixels, not tiles.
|
||||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
*
|
||||
* @return {number} The Y location in tile units.
|
||||
*/
|
||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
||||
{
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
|
||||
if (tilemapLayer)
|
||||
{
|
||||
if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
|
||||
if (!camera) { camera = tilemapLayer.scene.cameras.main; }
|
||||
|
||||
// Find the world position relative to the static or dynamic layer's top left origin,
|
||||
// factoring in the camera's vertical scroll
|
||||
|
@ -36,9 +34,7 @@ var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
|||
tileHeight *= tilemapLayer.scaleY;
|
||||
}
|
||||
|
||||
return snapToFloor
|
||||
? Math.floor(worldY / tileHeight)
|
||||
: worldY / tileHeight;
|
||||
return (snapToFloor) ? Math.floor(worldY / tileHeight) : worldY / tileHeight;
|
||||
};
|
||||
|
||||
module.exports = WorldToTileY;
|
||||
|
|
Loading…
Reference in a new issue