More control over how gallery selects images from events
This commit is contained in:
@@ -80,11 +80,18 @@
|
||||
updateFromQueue();
|
||||
changed = false;
|
||||
}
|
||||
else if (mode === "history" && (changed || ($queueCompleted && $queueCompleted.length != _entries.length))) {
|
||||
else if (mode === "history" && (changed || ($queueCompleted && $queueCompleted.length != _entries.length))) {
|
||||
updateFromHistory();
|
||||
changed = false;
|
||||
}
|
||||
|
||||
$: if (mode === "queue" && !$queuePending && !$queueRunning) {
|
||||
_queuedEntries = []
|
||||
_runningEntries = []
|
||||
_entries = [];
|
||||
changed = true
|
||||
}
|
||||
|
||||
async function deleteEntry(entry: QueueUIEntry, event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation()
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
<div id="dropzone"
|
||||
class="dropzone"
|
||||
bind:this={dropZone}
|
||||
on:pointerdown={hideDropZone}
|
||||
on:dragover={allowDrag}
|
||||
on:dragleave={hideDropZone}
|
||||
on:drop={handleDrop}
|
||||
|
||||
@@ -200,12 +200,14 @@
|
||||
elem_id="comfy-image-upload-block"
|
||||
{elem_classes}
|
||||
>
|
||||
<BlockLabel
|
||||
label={label}
|
||||
show_label={label != ""}
|
||||
Icon={FileIcon}
|
||||
float={label != ""}
|
||||
/>
|
||||
{#if label != ""}
|
||||
<BlockLabel
|
||||
label={label}
|
||||
show_label={label != ""}
|
||||
Icon={FileIcon}
|
||||
float={label != ""}
|
||||
/>
|
||||
{/if}
|
||||
{#if value && value.length > 0 && !pending_upload}
|
||||
{@const firstImage = value[0]}
|
||||
<ModifyUpload on:clear={handle_clear} absolute />
|
||||
|
||||
@@ -51,12 +51,20 @@
|
||||
let prevValue: string[] | FileData[] | null = value;
|
||||
export let selected_image: number | null = null;
|
||||
let old_selected_image: number | null = null;
|
||||
export let forceSelectImage: boolean | null = null;
|
||||
|
||||
$: if (prevValue !== value) {
|
||||
// When value is falsy (clear button or first load),
|
||||
// style.preview determines the selected image
|
||||
if (was_reset) {
|
||||
selected_image = style.preview && value?.length ? 0 : null;
|
||||
let selectImage: boolean = Boolean(style.preview && value?.length)
|
||||
let selectedIndex = 0;
|
||||
if (forceSelectImage != null) {
|
||||
selectImage = forceSelectImage
|
||||
selectedIndex = selected_image;
|
||||
forceSelectImage = null;
|
||||
}
|
||||
selected_image = selectImage ? selectedIndex : null;
|
||||
was_reset = false;
|
||||
// Otherwise we keep the selected_image the same if the
|
||||
// gallery has at least as many elements as it did before
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
{#if receiveTargets.length > 0}
|
||||
{#each receiveTargets as { workflow, targetNodes }}
|
||||
<Block>
|
||||
<BlockTitle>{workflow.attrs.title}</BlockTitle>
|
||||
<BlockTitle>Workflow: <b>{workflow.attrs.title}</b></BlockTitle>
|
||||
{#each targetNodes as targetNode}
|
||||
<Block>
|
||||
<div class="target">
|
||||
|
||||
Reference in New Issue
Block a user