From 4f04dae20f08f545becde5e58b1191ac8f4da493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 12 Sep 2015 22:26:16 +0200 Subject: [PATCH] Use the correct GEOMETRIC_EPSILON when matching beginnings and ends of curve in Curve.getParameterOf() Relates to #777 --- src/path/Curve.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/path/Curve.js b/src/path/Curve.js index eb4c4a67..85019fa7 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -592,11 +592,11 @@ statics: { getParameterOf: function(v, x, y) { // Handle beginnings and end separately, as they are not detected // sometimes. - var tolerance = /*#=*/Numerical.TOLERANCE, + var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON, abs = Math.abs; - if (abs(v[0] - x) < tolerance && abs(v[1] - y) < tolerance) + if (abs(v[0] - x) < epsilon && abs(v[1] - y) < epsilon) return 0; - if (abs(v[6] - x) < tolerance && abs(v[7] - y) < tolerance) + if (abs(v[6] - x) < epsilon && abs(v[7] - y) < epsilon) return 1; var txs = [], tys = [], @@ -619,7 +619,7 @@ statics: { ty = tx; } // Use average if we're within tolerance - if (abs(tx - ty) < tolerance) + if (abs(tx - ty) < /*#=*/Numerical.TOLERANCE) return (tx + ty) * 0.5; } }