From 9977b6ab680b712e5febf84c092a8c6e7ef8d887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rg=20Lehni?= Date: Mon, 5 Jan 2015 00:09:34 +0100 Subject: [PATCH] Some code clean-up. --- src/path/PathItem.Boolean.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index 6c8637fc..78c2a781 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -297,9 +297,8 @@ PathItem.inject(new function() { values = curve.values, winding = curve.winding, next = curve.next, - lastCurve, - lastT, - lastX0; + prevT, + prevX0; // Since the curves are monotone in y direction, we can just // compare the endpoints of the curve to determine if the // ray from query point along +-x direction will intersect @@ -324,9 +323,9 @@ PathItem.inject(new function() { - x0) <= tolerance // Detect 2nd case of a consecutive intercept, but make // sure we're still on the same loop - || lastCurve === curve.previous - && abs(lastX0 - x0) < tolerance - && lastT > tMax && t < tMin)) { + || i > 0 && curve.previous === curves[i - 1] + && abs(prevX0 - x0) < tolerance + && prevT > tMax && t < tMin)) { // Take care of cases where the curve and the preceding // curve merely touches the ray towards +-x direction, // but proceeds to the same side of the ray. @@ -348,9 +347,8 @@ PathItem.inject(new function() { windRight += winding; } } - lastCurve = curve; - lastT = t; - lastX0 = x0; + prevT = t; + prevX0 = x0; } } }