parent
4d7f7d0756
commit
590fa0894b
|
@ -210,6 +210,9 @@ function executeInPage(data) {
|
||||||
, elContent
|
, elContent
|
||||||
, svg
|
, svg
|
||||||
, svgValue
|
, svgValue
|
||||||
|
, boundingBox
|
||||||
|
, width
|
||||||
|
, height
|
||||||
|
|
||||||
toRemove = document.getElementsByClassName('mermaid')
|
toRemove = document.getElementsByClassName('mermaid')
|
||||||
if (toRemove && toRemove.length) {
|
if (toRemove && toRemove.length) {
|
||||||
|
@ -255,27 +258,29 @@ function executeInPage(data) {
|
||||||
|
|
||||||
svg = document.querySelector('svg')
|
svg = document.querySelector('svg')
|
||||||
|
|
||||||
var boundingBox = svg.getBoundingClientRect(); // the initial bonding box of the svg
|
boundingBox = svg.getBoundingClientRect(); // the initial bonding box of the svg
|
||||||
|
width = boundingBox.width * 1.5; // adding the scale factor for consistency with output in chrome browser
|
||||||
|
height = boundingBox.height * 1.5; // adding the scale factor for consistency with output in chrome browser
|
||||||
|
|
||||||
// resizing the body to fit the svg
|
// resizing the body to fit the svg
|
||||||
document.body.setAttribute(
|
document.body.setAttribute(
|
||||||
'style'
|
'style'
|
||||||
, 'width: ' + (boundingBox.width * 1.5) + '; height: ' + (boundingBox.height * 1.5) + ';'
|
, 'width: ' + width + '; height: ' + height + ';'
|
||||||
)
|
)
|
||||||
// resizing the svg via css for consistent display
|
// resizing the svg via css for consistent display
|
||||||
svg.setAttribute(
|
svg.setAttribute(
|
||||||
'style'
|
'style'
|
||||||
, 'width: ' + (boundingBox.width * 1.5) + '; height: ' + (boundingBox.height * 1.5) + ';'
|
, 'width: ' + width + '; height: ' + height + ';'
|
||||||
)
|
)
|
||||||
|
|
||||||
// set witdth and height attributes used to set the viewport when rending png image
|
// set witdth and height attributes used to set the viewport when rending png image
|
||||||
svg.setAttribute(
|
svg.setAttribute(
|
||||||
'width'
|
'width'
|
||||||
, boundingBox.width * 1.5
|
, width
|
||||||
)
|
)
|
||||||
svg.setAttribute(
|
svg.setAttribute(
|
||||||
'height'
|
'height'
|
||||||
, boundingBox.height * 1.5
|
, height
|
||||||
)
|
)
|
||||||
|
|
||||||
svgValue = xmlSerializer.serializeToString(svg)
|
svgValue = xmlSerializer.serializeToString(svg)
|
||||||
|
|
Loading…
Reference in New Issue