From 0298f540a95e4e31aea4f9613bd527991dd2a47b Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Sun, 14 Jun 2020 02:32:29 -0400 Subject: [PATCH] Fix stroke bounds for paths The check was being done backwards-- we should have been checking if values were less than the current minimum with padding subtracted from the *values*, and greater than the current maximum with padding added, but we were subtracting padding from the *minimum* (and adding padding to the maximum). Instead, we now add padding to the minimum and subtract it from the maximum, which is equivalent to subtracting padding from the values when comparing them to the minimum and adding padding to the values when comparing them to the maximum. --- src/path/Curve.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/path/Curve.js b/src/path/Curve.js index e0b173c8..1f13b07c 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -858,8 +858,8 @@ statics: /** @lends Curve */{ } padding /= 2; // strokePadding is in width, not radius - var minPad = min[coord] - padding, - maxPad = max[coord] + padding; + var minPad = min[coord] + padding, + maxPad = max[coord] - padding; // Perform a rough bounds checking first: The curve can only extend the // current bounds if at least one value is outside the min-max range. if ( v0 < minPad || v1 < minPad || v2 < minPad || v3 < minPad ||