From a20b0469d61c80d2205e77b6df11bfda3a3b6a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 27 Dec 2015 16:38:56 +0100 Subject: [PATCH] Correctly keep track of all straight curves that need their handles cleared at the end. Closes #838 --- src/path/PathItem.Boolean.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index 5c3d3e42..0d03fd6d 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -213,7 +213,7 @@ PathItem.inject(new function() { var tMin = /*#=*/Numerical.CURVETIME_EPSILON, tMax = 1 - tMin, noHandles = false, - clearSegments = [], + clearCurves = [], prevCurve, prevT; @@ -239,11 +239,12 @@ PathItem.inject(new function() { // Split the curve at t, passing true for _setHandles to always // set the handles on the sub-curves even if the original curve // had no handles. - segment = curve.divide(t, true, true)._segment1; - // Keep track of segments of curves without handles, so they can - // be cleared again at the end. + var newCurve = curve.divide(t, true, true); + // Keep track of curves without handles, so they can be cleared + // again at the end. if (noHandles) - clearSegments.push(segment); + clearCurves.push(curve, newCurve); + segment = newCurve._segment1; } loc._setSegment(segment); // Create links from the new segment to the intersection on the @@ -269,8 +270,8 @@ PathItem.inject(new function() { } // Clear segment handles if they were part of a curve with no handles, // once we are done with the entire curve. - for (var i = 0, l = clearSegments.length; i < l; i++) { - clearSegments[i].clearHandles(); + for (var i = 0, l = clearCurves.length; i < l; i++) { + clearCurves[i].clearHandles(); } }