File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1- export function getHtmlContent ( dot ?:string ) {
1+ export function getHtmlContent ( dot ?: string ) {
22 return `<!DOCTYPE html>
33 <html lang="en">
44
@@ -19,12 +19,22 @@ export function getHtmlContent(dot?:string){
1919 </div>
2020 </body>
2121 <script>
22+ function attributer(datum) {
23+ if (datum.tag == "svg") {
24+ const width = window.innerWidth
25+ const height = window.innerHeight
26+ datum.attributes.width = width
27+ datum.attributes.height = height
28+ datum.attributes.viewBox = [0, 0, width, height].join(" ")
29+ }
30+ }
31+
2232 (async function () {
2333 const vscode = acquireVsCodeApi()
2434 const dot='${ dot } '
2535 vscode.setState(dot)
2636 const res =await (await fetch(dot)).text()
27- const gv = d3.select('#app').graphviz().renderDot(res)
37+ const gv = d3.select('#app').graphviz().renderDot(res).attributer(attributer)
2838
2939 d3.select('#downloadSvg').on('click',()=>{
3040 const serializer = new XMLSerializer()
You can’t perform that action at this time.
0 commit comments