diff --git a/src/path/Curve.js b/src/path/Curve.js index ae895b66..ec018b2b 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -1076,7 +1076,12 @@ new function() { // Scope for methods that require numerical integration tMin, tMax, uMin, uMax, oldTDiff, reverse, recursion) { /*#*/ if (__options.fatlineClipping) { // Avoid deeper recursion. - if (recursion > 20) + // NOTE: @iconexperience determined that more than 20 recursions are + // needed sometimes, depending on the tDiff threshold values further + // below when determining which curve converges the least. He also + // recommended a threshold of 0.5 instead of the initial 0.8 + // See: https://github.com/paperjs/paper.js/issues/565 + if (recursion > 32) return; // Let P be the first curve and Q be the second var q0x = v2[0], q0y = v2[1], q3x = v2[6], q3y = v2[7], @@ -1127,7 +1132,7 @@ new function() { // Scope for methods that require numerical integration tMaxNew = tMax * tMaxClip + tMin * (1 - tMaxClip); } // Check if we need to subdivide the curves - if (oldTDiff > 0.8 && tDiff > 0.8) { + if (oldTDiff > 0.5 && tDiff > 0.5) { // Subdivide the curve which has converged the least. if (tMaxNew - tMinNew > uMax - uMin) { var parts = Curve.subdivide(v1, 0.5),