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

@@ -99,10 +99,7 @@ export default class ComfyImageCacheNode extends ComfyGraphNode {
if (newIndex === this.properties.index && !force)
return;
console.debug("[ComfyImageCacheNode] setIndex", newIndex, force)
if (!this.properties.images || newIndex < 0 || newIndex >= this.properties.images.images.length) {
console.debug("[ComfyImageCacheNode] invalid indexes", newIndex, this.properties.images)
return
}

View File

@@ -94,9 +94,9 @@ export class ComfySelectorTwo extends ComfyGraphNode {
ctx.fillStyle = "#AFB";
var y = (this.selected + 1) * LiteGraph.NODE_SLOT_HEIGHT + 6;
ctx.beginPath();
ctx.moveTo(50, y);
ctx.lineTo(50, y + LiteGraph.NODE_SLOT_HEIGHT);
ctx.lineTo(34, y + LiteGraph.NODE_SLOT_HEIGHT * 0.5);
ctx.moveTo(65, y);
ctx.lineTo(65, y + LiteGraph.NODE_SLOT_HEIGHT);
ctx.lineTo(49, y + LiteGraph.NODE_SLOT_HEIGHT * 0.5);
ctx.fill();
};

View File

@@ -141,7 +141,7 @@ export abstract class ComfyWidgetNode<T = any> extends ComfyGraphNode {
inputNode: LGraphNode,
inputIndex: number
): boolean {
if (this.autoConfig && "config" in input) {
if (this.autoConfig && "config" in input && this.outputs.length === 0) {
this.doAutoConfig(input as IComfyInputSlot)
}
@@ -397,11 +397,13 @@ export type GalleryOutputEntry = {
}
export interface ComfyGalleryProperties extends ComfyWidgetProperties {
index: number
}
export class ComfyGalleryNode extends ComfyWidgetNode<GradioFileData[]> {
override properties: ComfyGalleryProperties = {
defaultValue: []
defaultValue: [],
index: 0
}
static slotLayout: SlotLayout = {
@@ -420,14 +422,12 @@ export class ComfyGalleryNode extends ComfyWidgetNode<GradioFileData[]> {
override outputIndex = null;
override changedIndex = null;
index: number = 0;
constructor(name?: string) {
super(name, [])
}
override onExecute() {
this.setOutputData(0, this.index)
this.setOutputData(0, this.properties.index)
}
override onAction(action: any) {
@@ -446,6 +446,7 @@ export class ComfyGalleryNode extends ComfyWidgetNode<GradioFileData[]> {
// this.setValue(currentValue.concat(galleryItems))
this.setValue(galleryItems)
}
this.setProperty("index", 0)
}
}
@@ -472,7 +473,11 @@ export class ComfyGalleryNode extends ComfyWidgetNode<GradioFileData[]> {
else {
super.setValue([])
}
this.index = 0;
const len = get(this.value).length
if (this.properties.index < 0 || this.properties.index >= len) {
this.setProperty("index", clamp(this.properties.index, 0, len))
}
}
}