Skip to content

Commit d9c4890

Browse files
committed
Point.floor will Math.floor both the x and y values of the Point.
Point.ceil will Math.ceil both the `x` and `y` values of the Point.
1 parent b6b478f commit d9c4890

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/geom/Point.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,30 @@ Phaser.Point.prototype = {
455455

456456
},
457457

458+
/**
459+
* Math.floor() both the x and y properties of this Point.
460+
*
461+
* @method Phaser.Point#floor
462+
* @return {Phaser.Point} This Point object.
463+
*/
464+
floor: function () {
465+
466+
return this.setTo(Math.floor(this.x), Math.floor(this.y));
467+
468+
},
469+
470+
/**
471+
* Math.ceil() both the x and y properties of this Point.
472+
*
473+
* @method Phaser.Point#ceil
474+
* @return {Phaser.Point} This Point object.
475+
*/
476+
ceil: function () {
477+
478+
return this.setTo(Math.ceil(this.x), Math.ceil(this.y));
479+
480+
},
481+
458482
/**
459483
* Returns a string representation of this object.
460484
*

0 commit comments

Comments
 (0)