Optimize Curve#hasLength()

Only check the handles that are actually part of the curve.

Closes #1260
This commit is contained in:
Jürg Lehni 2017-02-22 17:29:23 +01:00
parent 919615f168
commit 6a4347e75b

View file

@ -1029,10 +1029,7 @@ statics: /** @lends Curve */{
* @return {Boolean} {@true if the curve is longer than the given epsilon}
*/
hasLength: function(epsilon) {
var seg1 = this._segment1,
seg2 = this._segment2;
return (!seg1._point.equals(seg2._point)
|| seg1.hasHandles() || seg2.hasHandles())
return (!this.getPoint1().equals(this.getPoint2()) || this.hasHandles())
&& this.getLength() > (epsilon || 0);
},