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.
This commit is contained in:
adroitwhiz 2020-06-14 02:32:29 -04:00
parent 498097172d
commit 0298f540a9

View file

@ -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 ||