diff --git a/AUTHORS.md b/AUTHORS.md index d8cb5a3a4c..c58440a861 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -15,3 +15,4 @@ - Scott Kieronski - Samuel Asensi - Takahiro Nishino +- Piotr Wilczynski diff --git a/src/basic/Point.js b/src/basic/Point.js index 85974a3eb8..50abdaa3f1 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -688,6 +688,18 @@ var Point = Base.extend(/** @lends Point# */{ return new Point(this.x % point.x, this.y % point.y); }, + /** + * Returns new point with both coordinates negated. + * @name Point#negate + * @function + * @operator + * @returns {Point} negation of both coordinates as new point. + * + * @example + * var point = new Point(12, -6); + * console.log(-point); // {x: -12, y: 6} + * console.log(point.negate()); // {x: -12, y: 6} + */ negate: function() { return new Point(-this.x, -this.y); },