Update phantomscript.js
attempt two at fixing the rendering issue
This commit is contained in:
parent
af0d40e907
commit
4d7f7d0756
|
@ -254,11 +254,31 @@ function executeInPage(data) {
|
|||
mermaid.init();
|
||||
|
||||
svg = document.querySelector('svg')
|
||||
svgValue = xmlSerializer.serializeToString(svg)
|
||||
|
||||
// make sure the entire view area is calculated before exiting
|
||||
// this solves an issue where the svg is not done rendering when the image is created
|
||||
svg.getBBox();
|
||||
var boundingBox = svg.getBoundingClientRect(); // the initial bonding box of the svg
|
||||
|
||||
// resizing the body to fit the svg
|
||||
document.body.setAttribute(
|
||||
'style'
|
||||
, 'width: ' + (boundingBox.width * 1.5) + '; height: ' + (boundingBox.height * 1.5) + ';'
|
||||
)
|
||||
// resizing the svg via css for consistent display
|
||||
svg.setAttribute(
|
||||
'style'
|
||||
, 'width: ' + (boundingBox.width * 1.5) + '; height: ' + (boundingBox.height * 1.5) + ';'
|
||||
)
|
||||
|
||||
// set witdth and height attributes used to set the viewport when rending png image
|
||||
svg.setAttribute(
|
||||
'width'
|
||||
, boundingBox.width * 1.5
|
||||
)
|
||||
svg.setAttribute(
|
||||
'height'
|
||||
, boundingBox.height * 1.5
|
||||
)
|
||||
|
||||
svgValue = xmlSerializer.serializeToString(svg)
|
||||
|
||||
//console.log(document.body.outerHTML);
|
||||
|
||||
|
|
Loading…
Reference in New Issue