mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Clean up Point#equals() code.
This commit is contained in:
parent
5e7b15c64e
commit
d9efb888bc
1 changed files with 5 additions and 4 deletions
|
@ -199,10 +199,11 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* console.log(point != new Point(1, 1)); // true
|
* console.log(point != new Point(1, 1)); // true
|
||||||
*/
|
*/
|
||||||
equals: function(point) {
|
equals: function(point) {
|
||||||
return point === this || point && (this.x === point.x
|
return this === point || point
|
||||||
&& this.y === point.y
|
&& (this.x === point.x && this.y === point.y
|
||||||
|| Array.isArray(point) && this.x === point[0]
|
|| Array.isArray(point)
|
||||||
&& this.y === point[1]) || false;
|
&& this.x === point[0] && this.y === point[1])
|
||||||
|
|| false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue