From 32bc07da8e446267b10968c393d05a6802da2dcc Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Tue, 23 May 2023 20:43:47 +0100 Subject: [PATCH] Fix crash due to latest comfyui changes --- export-workflow-svg/exportAsSvg.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/export-workflow-svg/exportAsSvg.js b/export-workflow-svg/exportAsSvg.js index 9378c19..76a1ecc 100644 --- a/export-workflow-svg/exportAsSvg.js +++ b/export-workflow-svg/exportAsSvg.js @@ -67,8 +67,8 @@ app.registerExtension({ ctx.resetTransform(); const style = document.defaultView.getComputedStyle(this.inputEl, null); - const x = parseInt(this.inputEl.style.left); - const y = parseInt(this.inputEl.style.top); + const x = parseInt(this.inputEl.style.left) + 10; + const y = parseInt(this.inputEl.style.top) + LiteGraph.NODE_TITLE_HEIGHT; const w = parseInt(this.inputEl.style.width); const h = parseInt(this.inputEl.style.height); ctx.fillStyle = style.getPropertyValue("background-color"); @@ -118,6 +118,10 @@ app.registerExtension({ const svgCtx = new C2S(bounds[2] - bounds[0], bounds[3] - bounds[1]); + svgCtx.canvas.getBoundingClientRect = function () { + return { width: svgCtx.width, height: svgCtx.height }; + }; + // Override the c2s handling of images to draw images as canvases const drawImage = svgCtx.drawImage; svgCtx.drawImage = function (...args) {