From 6a4347e75bd61470bbb00cb6320c48bd4e7eb4b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 22 Feb 2017 17:29:23 +0100 Subject: [PATCH] Optimize Curve#hasLength() Only check the handles that are actually part of the curve. Closes #1260 --- src/path/Curve.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/path/Curve.js b/src/path/Curve.js index 7a674cf6..7e0dc232 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -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); },