1
0
Fork 0

Point.flipX and point.flipY now default to 0

This commit is contained in:
Joost De Cock 2018-08-31 09:43:46 +02:00
parent 8f2f39ddb2
commit 85137b2334

View file

@ -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 */