From f886b1b117dc808f7fda31f0c9d9da90085c482f Mon Sep 17 00:00:00 2001 From: Jordan Thompson Date: Tue, 30 Dec 2025 19:09:27 -0800 Subject: [PATCH] Add fixed scale for ComfyUI zoom --- __init__.py | 2 +- web/comfy_retroarch_player.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/__init__.py b/__init__.py index b68fc2a..149acb9 100644 --- a/__init__.py +++ b/__init__.py @@ -9,7 +9,7 @@ class ComfyRetroArchPlayer: RETURN_TYPES = () OUTPUT_NODE = True FUNCTION = "run" - CATEGORY = "fun" + CATEGORY = "WAS/Play" def run(self): return () diff --git a/web/comfy_retroarch_player.js b/web/comfy_retroarch_player.js index d7f9996..1092c39 100644 --- a/web/comfy_retroarch_player.js +++ b/web/comfy_retroarch_player.js @@ -93,7 +93,7 @@ function getContainer() { el.style.width = "0"; el.style.height = "0"; el.style.pointerEvents = "none"; - el.style.zIndex = "1000"; + el.style.zIndex = "100"; document.body.appendChild(el); STATE.container = el; return el; @@ -110,7 +110,7 @@ function ensureIframeForNode(node) { const iframe = document.createElement("iframe"); iframe.setAttribute( "sandbox", - "allow-scripts allow-same-origin allow-forms allow-popups allow-downloads allow-pointer-lock" + "allow-scripts allow-forms allow-popups allow-downloads allow-pointer-lock" ); iframe.style.position = "absolute"; iframe.style.border = "0"; @@ -183,8 +183,10 @@ function updateIframeRect(node, iframe) { iframe.style.left = `${Math.round(nx)}px`; iframe.style.top = `${Math.round(ny)}px`; - iframe.style.width = `${Math.max(0, Math.round(nw))}px`; - iframe.style.height = `${Math.max(0, Math.round(nh))}px`; + iframe.style.width = `${Math.max(0, Math.round(nw / scale))}px`; + iframe.style.height = `${Math.max(0, Math.round(nh / scale))}px`; + iframe.style.transform = `scale(${scale})`; + iframe.style.transformOrigin = 'top left'; const isCollapsed = !!node.flags?.collapsed; const hasArea = nw >= 2 && nh >= 2;