diff --git a/src/lib/components/ImageUpload.svelte b/src/lib/components/ImageUpload.svelte index 224ad73..85358df 100644 --- a/src/lib/components/ImageUpload.svelte +++ b/src/lib/components/ImageUpload.svelte @@ -18,6 +18,7 @@ export let elem_classes: string[] = [] export let style: string = "" export let label: string = "" + export let mask: ComfyImageLocation | null; // let propsChanged: Writable | null = null; let dragging = false; let pending_upload = false; @@ -172,6 +173,15 @@ bind:naturalWidth={imgWidth} bind:naturalHeight={imgHeight} /> + {#key mask} + {#if mask} + + {firstImage.filename} + {/if} + {/key} {:else} 0; $: if (!hasImage) { editMask = false; } + let mask: ComfyImageLocation | null; + $: if (hasImage && canMask) { + mask = $nodeValue[0].children?.find(i => i.tags.includes("mask"))?.comfyUIFile; + } + else { + mask = null; + } + const MASK_FILENAME: string = "ComfyBoxMask.png" async function onMaskReleased(e: CustomEvent) { @@ -122,6 +129,7 @@ // TODO other child image types preserved here? image.children = []; } + mask = null; if (maskCanvasComp) { maskCanvasComp.clearStrokes(); } @@ -232,6 +240,7 @@