Random fixes

This commit is contained in:
space-nuko
2023-05-05 23:40:01 -05:00
parent 432ac95c94
commit 0a3010ddd1
12 changed files with 5464 additions and 3291 deletions

View File

@@ -8,6 +8,7 @@
import type { ComfyGalleryNode } from "$lib/nodes/ComfyWidgetNodes";
import type { FileData as GradioFileData } from "@gradio/upload";
import type { SelectData as GradioSelectData } from "@gradio/utils";
import { clamp } from "$lib/utils";
export let widget: WidgetLayout | null = null;
let node: ComfyGalleryNode | null = null;
@@ -22,7 +23,11 @@
node = widget.node as ComfyGalleryNode
nodeValue = node.value;
propsChanged = node.propsChanged;
node.index = 0;
const len = $nodeValue.length
if (node.properties.index < 0 || node.properties.index >= len) {
node.setProperty("index", clamp(node.properties.index, 0, len))
}
}
};
@@ -46,7 +51,7 @@
}, 200)
// Update index
node.index = e.detail.index as number;
node.setProperty("index", e.detail.index as number)
}
</script>