Do not change properties on bbox directly it throws errors in edge.
This commit is contained in:
@@ -256,17 +256,22 @@ class SvgRenderer {
|
||||
// This may have false-positives, but at least the bbox will always
|
||||
// contain the full graphic including strokes.
|
||||
const halfStrokeWidth = this._findLargestStrokeWidth(this._svgTag) / 2;
|
||||
bbox.width += halfStrokeWidth * 2;
|
||||
bbox.height += halfStrokeWidth * 2;
|
||||
bbox.x -= halfStrokeWidth;
|
||||
bbox.y -= halfStrokeWidth;
|
||||
const width = bbox.width + (halfStrokeWidth * 2);
|
||||
const height = bbox.height + (halfStrokeWidth * 2);
|
||||
const x = bbox.x - halfStrokeWidth;
|
||||
const y = bbox.y - halfStrokeWidth;
|
||||
|
||||
// Set the correct measurements on the SVG tag, and save them.
|
||||
this._svgTag.setAttribute('width', bbox.width);
|
||||
this._svgTag.setAttribute('height', bbox.height);
|
||||
this._svgTag.setAttribute('width', width);
|
||||
this._svgTag.setAttribute('height', height);
|
||||
this._svgTag.setAttribute('viewBox',
|
||||
`${bbox.x} ${bbox.y} ${bbox.width} ${bbox.height}`);
|
||||
this._measurements = bbox;
|
||||
`${x} ${y} ${width} ${height}`);
|
||||
this._measurements = {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user