More UI improvements

This commit is contained in:
space-nuko
2023-05-10 18:15:02 -05:00
parent fb697ca1a1
commit e4497e2537
16 changed files with 19993 additions and 18673 deletions

View File

@@ -95,10 +95,10 @@
{/each}
</div>
{#if isHidden(container) && edit}
<div class="handle handle-hidden" class:hidden={!edit} />
<div class="handle handle-hidden" style="z-index: {zIndex+100}" class:hidden={!edit} />
{/if}
{#if showHandles}
<div class="handle handle-container" data-drag-item-id={container.id} on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}/>
<div class="handle handle-container" style="z-index: {zIndex+100}" data-drag-item-id={container.id} on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}/>
{/if}
</Accordion>
</Block>

View File

@@ -91,10 +91,10 @@
{/each}
</div>
{#if isHidden(container) && edit}
<div class="handle handle-hidden" class:hidden={!edit} />
<div class="handle handle-hidden" style="z-index: {zIndex+100}" class:hidden={!edit} />
{/if}
{#if showHandles}
<div class="handle handle-container" data-drag-item-id={container.id} on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}/>
<div class="handle handle-container" style="z-index: {zIndex+100}" data-drag-item-id={container.id} on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}/>
{/if}
</Block>
</div>

View File

@@ -12,7 +12,6 @@
import { ImageViewer } from "$lib/ImageViewer";
import type { ComfyAPIStatus } from "$lib/api";
import { SvelteToast, toast } from '@zerodevx/svelte-toast'
import defaultGraph from "$lib/defaultGraph"
import { LGraph } from "@litegraph-ts/core";
import LightboxModal from "./LightboxModal.svelte";
@@ -132,7 +131,7 @@
async function doLoadDefault() {
var confirmed = confirm("Are you sure you want to clear the current workflow and load the default graph?");
if (confirmed) {
await app.deserialize(defaultGraph)
await app.initDefaultGraph();
}
}

View File

@@ -1,7 +1,6 @@
import { LiteGraph, LGraph, LGraphCanvas, LGraphNode, type LGraphNodeConstructor, type LGraphNodeExecutable, type SerializedLGraph, type SerializedLGraphGroup, type SerializedLGraphNode, type SerializedLLink, NodeMode, type Vector2, BuiltInSlotType } from "@litegraph-ts/core";
import type { LConnectionKind, INodeSlot } from "@litegraph-ts/core";
import ComfyAPI, { type ComfyAPIQueueStatus } from "$lib/api"
import defaultGraph from "$lib/defaultGraph"
import { getPngMetadata, importA1111 } from "$lib/pnginfo";
import EventEmitter from "events";
import type TypedEmitter from "typed-emitter";
@@ -32,6 +31,7 @@ import uiState from "$lib/stores/uiState";
import { download, jsonToJsObject, promptToGraphVis, range, workflowToGraphVis } from "$lib/utils";
import notify from "$lib/notify";
import configState from "$lib/stores/configState";
import { blankGraph } from "$lib/defaultGraph";
export const COMFYBOX_SERIAL_VERSION = 1;
@@ -436,7 +436,16 @@ export default class ComfyApp {
}
async initDefaultGraph() {
const state = structuredClone(defaultGraph)
let state = null;
try {
const graphResponse = await fetch("/workflows/defaultWorkflow.json");
state = await graphResponse.json() as SerializedAppState;
}
catch (error) {
console.error("Failed to load default graph", error)
notify(`Failed to load default graph: ${error}`, { type: "error" })
state = structuredClone(blankGraph)
}
await this.deserialize(state)
}
@@ -840,7 +849,7 @@ export default class ComfyApp {
const def = defs[backendNode.type];
const rawValues = def["input"]["required"][inputSlot.name][0];
console.warn("[ComfyApp] Reconfiguring combo widget", backendNode.type, "=>", comboNode.type, inputSlot.config.values.length)
console.warn("[ComfyApp] Reconfiguring combo widget", backendNode.type, "=>", comboNode.type, rawValues.length)
comboNode.doAutoConfig(inputSlot, { includeProperties: new Set(["values"]), setWidgetTitle: false })
comboNode.formatValues(rawValues)

View File

@@ -110,10 +110,10 @@
{/each}
</div>
{#if isHidden(container) && edit}
<div class="handle handle-hidden" class:hidden={!edit} />
<div class="handle handle-hidden" style="z-index: {zIndex+100}" class:hidden={!edit} />
{/if}
{#if showHandles}
<div class="handle handle-container" data-drag-item-id={container.id} on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}/>
<div class="handle handle-container" style="z-index: {zIndex+100}" data-drag-item-id={container.id} on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}/>
{/if}
</Block>
{:else}