Component additions & lock graph

This commit is contained in:
space-nuko
2023-05-08 21:05:04 -05:00
parent 37701f6a54
commit 14e0a2d9fd
8 changed files with 57 additions and 16 deletions

View File

@@ -21,6 +21,7 @@
let option: number | null = null;
let imageWidth: number = 1;
let imageHeight: number = 1;
let selected_image: number | null = null;
$: widget && setNodeValue(widget);
@@ -29,6 +30,7 @@
node = widget.node as ComfyGalleryNode
nodeValue = node.value;
propsChanged = node.propsChanged;
node.anyImageSelected = false;
if ($nodeValue != null) {
if (node.properties.index < 0 || node.properties.index >= $nodeValue.length) {
@@ -132,7 +134,22 @@
// Update index
node.setProperty("index", e.detail.index as number)
node.anyImageSelected = true;
}
$: if ($propsChanged > -1 && widget && $nodeValue) {
if (widget.attrs.variant === "image") {
selected_image = $nodeValue.length - 1
node.setProperty("index", selected_image)
node.anyImageSelected = true;
}
}
else {
node.setProperty("index", null)
node.anyImageSelected = false;
}
$: node.anyImageSelected = selected_image != null;
</script>
{#if widget && node && nodeValue}
@@ -166,6 +183,7 @@
on:select={onSelect}
bind:imageWidth
bind:imageHeight
bind:selected_image
/>
</div>
</Block>