update iframe dimension

This commit is contained in:
nofunstudio
2025-02-02 23:49:06 -07:00
parent c8e8eac5c6
commit 97fe373591
3 changed files with 9 additions and 10 deletions
Binary file not shown.
+1 -2
View File
@@ -129,11 +129,10 @@ class IframeView:
"scene_state": (
"STRING",
{
"multiline": True,
"default": "{\"camera\": {\"position\": [0,0,5]}, \"animation\": false}",
},
),
"frame_count": ("INT", {"default": 4, "min": 1, "max": 60}),
"frame_count": ("INT", {"default": 4, "min": 1, "max": 400}),
},
"hidden": {
"unique_id": "UNIQUE_ID",
+8 -8
View File
@@ -7,6 +7,12 @@ window.TEXTURE_STORE = window.TEXTURE_STORE || {};
// Function to create the iframe widget
async function widgetIframe(node, nodeData, inputData, app) {
// Locate our parameter widgets
const urlWidget = node.widgets.find((w) => w.name === "url");
const widthWidget = node.widgets.find((w) => w.name === "width");
const heightWidget = node.widgets.find((w) => w.name === "height");
const stateWidget = node.widgets.find((w) => w.name === "scene_state");
console.log("[widgetIframe] Initializing iframe widget for node:", node);
node.isCaptureComplete = false;
// Create iframe wrapper with some styling
@@ -23,8 +29,8 @@ async function widgetIframe(node, nodeData, inputData, app) {
// Create the iframe element
const iframe = $el("iframe", {
style: {
width: "100%",
height: "100%",
width: widthWidget.value + "px",
height: heightWidget.value + "px",
border: "none",
},
sandbox: "allow-scripts allow-same-origin allow-forms",
@@ -33,12 +39,6 @@ async function widgetIframe(node, nodeData, inputData, app) {
iframeWrapper.appendChild(iframe);
// Locate our parameter widgets
const urlWidget = node.widgets.find((w) => w.name === "url");
const widthWidget = node.widgets.find((w) => w.name === "width");
const heightWidget = node.widgets.find((w) => w.name === "height");
const stateWidget = node.widgets.find((w) => w.name === "scene_state");
// Set initial URL if provided
if (urlWidget.value) {
iframe.src = urlWidget.value;