Display mask on image upload

This commit is contained in:
space-nuko
2023-05-29 18:45:08 -05:00
parent 97bc7ce6ba
commit 8890e45b66
2 changed files with 23 additions and 1 deletions

View File

@@ -52,12 +52,19 @@
};
let hasImage = false;
$: hasImage = $nodeValue && $nodeValue.length > 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<MaskCanvasData>) {
@@ -122,6 +129,7 @@
// TODO other child image types preserved here?
image.children = [];
}
mask = null;
if (maskCanvasComp) {
maskCanvasComp.clearStrokes();
}
@@ -232,6 +240,7 @@
<ImageUpload value={_value}
bind:imgWidth={$imgWidth}
bind:imgHeight={$imgHeight}
{mask}
fileCount={"single"}
elem_classes={[]}
style={""}