Skip to content

Commit ab4046b

Browse files
committed
Only enlarge by half stroke width on either side
1 parent 3565c95 commit ab4046b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/svg-quirks-mode/svg-renderer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ class SvgRenderer {
234234
// Enlarge the bbox from the largest found stroke width
235235
// This may have false-positives, but at least the bbox will always
236236
// contain the full graphic including strokes.
237-
const largestStrokeWidth = this._findLargestStrokeWidth(this._svgTag);
238-
bbox.width += largestStrokeWidth * 2;
239-
bbox.height += largestStrokeWidth * 2;
240-
bbox.x -= largestStrokeWidth;
241-
bbox.y -= largestStrokeWidth;
237+
const halfStrokeWidth = this._findLargestStrokeWidth(this._svgTag) / 2;
238+
bbox.width += halfStrokeWidth * 2;
239+
bbox.height += halfStrokeWidth * 2;
240+
bbox.x -= halfStrokeWidth;
241+
bbox.y -= halfStrokeWidth;
242242

243243
// Set the correct measurements on the SVG tag, and save them.
244244
this._svgTag.setAttribute('width', bbox.width);

0 commit comments

Comments
 (0)