✨ Point.flipX and point.flipY now default to 0
This commit is contained in:
parent
8f2f39ddb2
commit
85137b2334
1 changed files with 7 additions and 5 deletions
12
src/point.js
12
src/point.js
|
@ -1,5 +1,5 @@
|
|||
import Attributes from "./attributes";
|
||||
import { round } from "./round";
|
||||
import { round } from "./utils";
|
||||
|
||||
function Point(x, y) {
|
||||
this.x = round(x);
|
||||
|
@ -72,13 +72,15 @@ Point.prototype.copy = function() {
|
|||
};
|
||||
|
||||
/** Mirrors this point around X value of that point */
|
||||
Point.prototype.flipX = function(that) {
|
||||
return new Point(that.x + this.dx(that), this.y);
|
||||
Point.prototype.flipX = function(that = false) {
|
||||
if (that === false) return new Point(this.x * -1, this.y);
|
||||
else return new Point(that.x + this.dx(that), this.y);
|
||||
};
|
||||
|
||||
/** Mirrors this point around Y value of that point */
|
||||
Point.prototype.flipY = function(that) {
|
||||
return new Point(this.x, that.y + this.dy(that));
|
||||
Point.prototype.flipY = function(that = false) {
|
||||
if (that === false) return new Point(this.x, this.y * -1);
|
||||
else return new Point(this.x, that.y + this.dy(that));
|
||||
};
|
||||
|
||||
/** Shifts this point distance in the deg direction */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue