Only enlarge by half stroke width on either side
This commit is contained in:
@@ -234,11 +234,11 @@ class SvgRenderer {
|
||||
// Enlarge the bbox from the largest found stroke width
|
||||
// This may have false-positives, but at least the bbox will always
|
||||
// contain the full graphic including strokes.
|
||||
const largestStrokeWidth = this._findLargestStrokeWidth(this._svgTag);
|
||||
bbox.width += largestStrokeWidth * 2;
|
||||
bbox.height += largestStrokeWidth * 2;
|
||||
bbox.x -= largestStrokeWidth;
|
||||
bbox.y -= largestStrokeWidth;
|
||||
const halfStrokeWidth = this._findLargestStrokeWidth(this._svgTag) / 2;
|
||||
bbox.width += halfStrokeWidth * 2;
|
||||
bbox.height += halfStrokeWidth * 2;
|
||||
bbox.x -= halfStrokeWidth;
|
||||
bbox.y -= halfStrokeWidth;
|
||||
|
||||
// Set the correct measurements on the SVG tag, and save them.
|
||||
this._svgTag.setAttribute('width', bbox.width);
|
||||
|
||||
Reference in New Issue
Block a user