diff --git a/src/path/Curve.js b/src/path/Curve.js index e0b173c856..1f13b07cea 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 || diff --git a/test/tests/Item_Bounds.js b/test/tests/Item_Bounds.js index b3c52f5609..0dcc8e4a01 100644 --- a/test/tests/Item_Bounds.js +++ b/test/tests/Item_Bounds.js @@ -798,3 +798,19 @@ test('#1561 item._globalMatrix on item after empty symbol', function(){ view.update(); equals(item._globalMatrix, new Matrix()); }); + +test('path.strokeBounds applies stroke padding properly (#1824)', function() { + var ellipse = new Path.Ellipse({ + point: [100, 100], + size: [50, 80], + strokeWidth: 32, + strokeColor: 'red' + }); + + ellipse.rotate(50); + equals( + ellipse.strokeBounds, + new Rectangle(74.39306, 91.93799, 101.21388, 96.12403), + 'ellipse.strokeBounds' + ); +})