From ea29e65e6b1690a59a2afaa0c26c002dfe9443fa Mon Sep 17 00:00:00 2001 From: hkrish Date: Fri, 14 Feb 2014 22:50:55 +0100 Subject: [PATCH] _tracePaths: Switch contours only if necessary --- src/path/PathItem.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/path/PathItem.js b/src/path/PathItem.js index 0e72a86b..18f2a5a4 100644 --- a/src/path/PathItem.js +++ b/src/path/PathItem.js @@ -359,15 +359,11 @@ var PathItem = Item.extend(/** @lends PathItem# */{ sign = t === 0 ? 2 : (t === 1 ? -2 : 0); if (sign !== 0) { i = sign > 0 ? 0 : 6; - if (Curve.isLinear(v)) { - // Return slope from this point that follows the direction - // of the line + // Return slope from this point that follows the direction + // of the line + if (Curve.isLinear(v)) sign *= 3; - tan = new Point(v[i+sign] - v[i], v[i+sign+1] - v[i+1]); - } else { - // Return the first or last handle - tan = new Point(v[i+sign] - v[i], v[i+sign+1] - v[i+1]); - } + tan = new Point(v[i+sign] - v[i], v[i+sign+1] - v[i+1]); } else { tan = Curve.evaluate(v, t, 1); } @@ -522,7 +518,8 @@ var PathItem = Item.extend(/** @lends PathItem# */{ // If the intersection segment is valid, try switching to // it, with an appropriate direction to continue traversal. // else, stay on the same contour. - if (ixOther && (ixOtherSeg = ixOther._segment) && + if (!operator(seg._winding) && ixOther && + (ixOtherSeg = ixOther._segment) && ixOtherSeg !== startSeg && firstHandleIn) { entryExitTangents = getEntryExitTangents(seg); c1 = seg.getCurve();