From faf22fccf479c899e62cb01a5445b8a0cb3fa0e1 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Sat, 6 May 2023 15:25:57 -0500 Subject: [PATCH] Fix --- src/lib/components/ComfyApp.ts | 20 +++++++++--------- src/lib/components/ComfyProperties.svelte | 21 ++++++++++++++----- src/lib/components/ComfyUnlockUIButton.svelte | 6 +++++- src/lib/stores/uiState.ts | 2 +- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/lib/components/ComfyApp.ts b/src/lib/components/ComfyApp.ts index 2070e00..080ec96 100644 --- a/src/lib/components/ComfyApp.ts +++ b/src/lib/components/ComfyApp.ts @@ -232,17 +232,17 @@ export default class ComfyApp { } private addDropHandler() { - this.dropZone = document.getElementById("dropzone"); + // this.dropZone = document.getElementById("dropzone"); - if (this.dropZone) { - window.addEventListener('dragenter', this.allowDrag.bind(this)); - this.dropZone.addEventListener('dragover', this.allowDrag.bind(this)); - this.dropZone.addEventListener('dragleave', this.hideDropZone.bind(this)); - this.dropZone.addEventListener('drop', this.handleDrop.bind(this)); - } - else { - console.warn("No dropzone detected (probably on mobile).") - } + // if (this.dropZone) { + // window.addEventListener('dragenter', this.allowDrag.bind(this)); + // this.dropZone.addEventListener('dragover', this.allowDrag.bind(this)); + // this.dropZone.addEventListener('dragleave', this.hideDropZone.bind(this)); + // this.dropZone.addEventListener('drop', this.handleDrop.bind(this)); + // } + // else { + // console.warn("No dropzone detected (probably on mobile).") + // } } /** diff --git a/src/lib/components/ComfyProperties.svelte b/src/lib/components/ComfyProperties.svelte index b4fe006..9956714 100644 --- a/src/lib/components/ComfyProperties.svelte +++ b/src/lib/components/ComfyProperties.svelte @@ -40,6 +40,9 @@ for (const cat of Object.values(ALL_ATTRIBUTES)) { for (const spec of Object.values(cat.specs)) { if (spec.location === "widget" && target.attrs[spec.name] == null) { + if (!spec.editable) + continue; + if (spec.canShow && !spec.canShow(target)) continue; @@ -117,7 +120,7 @@ } function updateAttribute(spec: AttributesSpec, target: IDragItem | null, value: any) { - if (target == null) + if (target == null || !spec.editable) return; const name = spec.name @@ -142,7 +145,7 @@ } function updateProperty(spec: AttributesSpec, value: any) { - if (node == null) + if (node == null || !spec.editable) return const name = spec.name @@ -170,7 +173,7 @@ } function updateVar(spec: AttributesSpec, value: any) { - if (node == null) + if (node == null || !spec.editable) return; const name = spec.name @@ -190,8 +193,11 @@ $refreshPanel += 1; } - function updateWorkflowAttribute(entry: AttributesSpec, value: any) { - const name = entry.name + function updateWorkflowAttribute(spec: AttributesSpec, value: any) { + if (!spec.editable) + return; + + const name = spec.name console.warn("updateWorkflowAttribute", name, value) $layoutState.attrs[name] = value @@ -389,6 +395,11 @@ .title { font-weight: bold; + + .type { + padding-left: 0.25rem; + font-weight: normal; + } } } diff --git a/src/lib/components/ComfyUnlockUIButton.svelte b/src/lib/components/ComfyUnlockUIButton.svelte index 1358d7c..5b952c1 100644 --- a/src/lib/components/ComfyUnlockUIButton.svelte +++ b/src/lib/components/ComfyUnlockUIButton.svelte @@ -25,10 +25,14 @@ width: var(--size-12); height: var(--size-12); - > :global(.lg) { + > :global(.secondary.lg) { border: var(--button-border-width) solid var(--neutral-400); } + > :global(.primary.lg) { + border: var(--button-border-width) solid var(--primary-400); + } + &.toggled { :global(svg) { color: var(--button-primary-text-color); diff --git a/src/lib/stores/uiState.ts b/src/lib/stores/uiState.ts index 76b15fa..a7c3cc6 100644 --- a/src/lib/stores/uiState.ts +++ b/src/lib/stores/uiState.ts @@ -20,7 +20,7 @@ const store: WritableUIStateStore = writable( graphLocked: false, nodesLocked: false, autoAddUI: true, - uiUnlocked: true, + uiUnlocked: false, uiEditMode: "widgets" })