From 7ca8ce3cbb82731fb21b92e65cf2eeb1c6d53572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 24 Aug 2015 21:02:42 +0200 Subject: [PATCH] Actually use selfOp argument for self operations. Appears to be working fine. --- src/path/PathItem.Boolean.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index e9d815b5..c4e51c9b 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -199,7 +199,8 @@ PathItem.inject(new function() { } // Trace closed contours and insert them into the result. var result = new CompoundPath(Item.NO_INSERT); - result.addChildren(tracePaths(segments, monoCurves, operation), true); + result.addChildren(tracePaths(segments, monoCurves, operation, !_path2), + true); // See if the CompoundPath can be reduced to just a simple Path. result = result.reduce(); result.insertAbove(path1); @@ -496,7 +497,7 @@ PathItem.inject(new function() { // If the intersection segment is valid, try switching to // it, with an appropriate direction to continue traversal. // Else, stay on the same contour. - if (added && (!operator(seg._winding) || selfOp) + if (added && (selfOp || !operator(seg._winding)) && (inter = seg._intersection) && (interSeg = inter._segment) && interSeg !== startSeg) { @@ -577,17 +578,19 @@ PathItem.inject(new function() { // Move to the next segment according to the traversal direction seg = dir > 0 ? seg.getNext() : seg. getPrevious(); if (reportSegments) { - console.log(seg, !seg._visited, + console.log(seg, seg && !seg._visited, seg !== startSeg, seg !== startInterSeg, - seg._intersection, operator(seg._winding)); + seg && seg._intersection, seg && operator(seg._winding)); if (!(seg && !seg._visited && seg !== startSeg && seg !== startInterSeg && (seg._intersection || operator(seg._winding)))) { - new Path.Circle({ - center: seg.point, - radius: 4, - fillColor: 'red' - }); + if (seg) { + new Path.Circle({ + center: seg.point, + radius: 4, + fillColor: 'red' + }); + } } } } while (seg && !seg._visited