From 84e1f208fb8eb4cedd303b4b6d48cbe66cc129f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 20 Feb 2014 20:44:15 +0100 Subject: [PATCH] Revert change in d730b75073553c6039833ffb9f4253159127b660 As highlighted by @hari in the comments. --- src/path/PathItem.Boolean.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index 8fd4088a..79f472ca 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -192,7 +192,8 @@ PathItem.inject(new function() { * @param {CurveLocation[]} intersections Array of CurveLocation objects */ function splitPath(intersections) { - var linearSegments; + var TOLERANCE = /*#=*/ Numerical.TOLERANCE, + linearSegments; function resetLinear() { // Reset linear segments if they were part of a linear curve @@ -226,7 +227,13 @@ PathItem.inject(new function() { segment = newCurve._segment1; curve = newCurve.getPrevious(); } else { - segment = t < 0.5 ? curve._segment1 : curve._segment2; + segment = t < TOLERANCE + ? curve._segment1 + : t > 1 - TOLERANCE + ? curve._segment2 + : curve.getPartLength(0, t) < curve.getPartLength(t, 1) + ? curve._segment1 + : curve._segment2; } // Link the new segment with the intersection on the other curve segment._intersection = loc.getIntersection();