mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
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:
parent
498097172d
commit
0298f540a9
1 changed files with 2 additions and 2 deletions
|
@ -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 ||
|
||||
|
|
Loading…
Reference in a new issue