mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Optimize Curve#hasLength()
Only check the handles that are actually part of the curve. Closes #1260
This commit is contained in:
parent
919615f168
commit
6a4347e75b
1 changed files with 1 additions and 4 deletions
|
@ -1029,10 +1029,7 @@ statics: /** @lends Curve */{
|
||||||
* @return {Boolean} {@true if the curve is longer than the given epsilon}
|
* @return {Boolean} {@true if the curve is longer than the given epsilon}
|
||||||
*/
|
*/
|
||||||
hasLength: function(epsilon) {
|
hasLength: function(epsilon) {
|
||||||
var seg1 = this._segment1,
|
return (!this.getPoint1().equals(this.getPoint2()) || this.hasHandles())
|
||||||
seg2 = this._segment2;
|
|
||||||
return (!seg1._point.equals(seg2._point)
|
|
||||||
|| seg1.hasHandles() || seg2.hasHandles())
|
|
||||||
&& this.getLength() > (epsilon || 0);
|
&& this.getLength() > (epsilon || 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue