Skip to content

Commit

Permalink
Enlarge bounds by largest stroke even if zero
Browse files Browse the repository at this point in the history
  • Loading branch information
adroitwhiz committed Feb 14, 2020
1 parent f472eb5 commit 6782995
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/svg-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,8 @@ 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.
// If the width or height is zero however, don't enlarge since
// they won't have a stroke width that needs to be enlarged.
let halfStrokeWidth;
if (bbox.width === 0 || bbox.height === 0) {
halfStrokeWidth = 0;
} else {
halfStrokeWidth = this._findLargestStrokeWidth(this._svgTag) / 2;
}
const halfStrokeWidth = this._findLargestStrokeWidth(this._svgTag) / 2;

const width = bbox.width + (halfStrokeWidth * 2);
const height = bbox.height + (halfStrokeWidth * 2);
const x = bbox.x - halfStrokeWidth;
Expand Down

0 comments on commit 6782995

Please sign in to comment.