From 31aa68b2d199e676d91e279bda69d8b3c7e632db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 6 Jan 2017 14:15:32 +0100 Subject: [PATCH] Some further code cleanup for 3c2588fdec1035d3960b46d5c7271d6ed5e2b7ff --- src/path/PathItem.Boolean.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index a2ac72bd..fa834aec 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -635,8 +635,10 @@ PathItem.inject(new function() { // Determine winding at three points in the chain. If a winding with // sufficient quality is found, use it. Otherwise use the winding with // the best quality. - var offsets = [0.48, 0.1, 0.9]; - for (var i = 0; (!winding || winding.quality < 0.5) && i < offsets.length; i++) { + var offsets = [0.48, 0.1, 0.9], + windingZero = { winding: 0, quality: 0 }, + winding = windingZero; + for (var i = 0; i < offsets.length && winding.quality < 0.5; i++) { var length = totalLength * offsets[i]; for (var j = 0, l = chain.length; j < l; j++) { var entry = chain[j], @@ -658,17 +660,15 @@ PathItem.inject(new function() { // While subtracting, we need to omit this curve if it is // contributing to the second operand and is outside the // first operand. - var windingNew = !(operator.subtract && path2 && ( + var wind = !(operator.subtract && path2 && ( path === path1 && path2._getWinding(pt, dir, true).winding || path === path2 && !path1._getWinding(pt, dir, true).winding)) ? getWinding(pt, curves, dir, true) - : { winding: 0 }; - if (windingNew.winding && - (!winding || winding.quality < windingNew.quality)) { - winding = windingNew; - } + : windingZero; + if (wind.quality > winding.quality) + winding = wind; break; } length -= curveLength;