mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-21 14:57:07 +08:00
Dont reorder open workflows
Allow elements around canvas
This commit is contained in:
parent
c3c76dffe8
commit
ea611cf8c9
@ -56,6 +56,10 @@ export class ComfyApp {
|
||||
this.logging = new ComfyLogging(this);
|
||||
this.workflowManager = new ComfyWorkflowManager(this);
|
||||
this.menu = new ComfyAppMenu(this);
|
||||
this.bodyTop = $el("div.comfyui-body-top", { parent: document.body });
|
||||
this.bodyLeft = $el("div.comfyui-body-left", { parent: document.body });
|
||||
this.bodyRight = $el("div.comfyui-body-right", { parent: document.body });
|
||||
this.bodyBottom = $el("div.comfyui-body-bottom", { parent: document.body });
|
||||
|
||||
/**
|
||||
* List of extensions that are registered with the app
|
||||
|
||||
@ -33,7 +33,7 @@ function getClipPath(node, element, elRect) {
|
||||
}
|
||||
|
||||
const widgetRect = element.getBoundingClientRect();
|
||||
const clipX = intersection[0] - widgetRect.x / scale + "px";
|
||||
const clipX = elRect.left + intersection[0] - widgetRect.x / scale + "px";
|
||||
const clipY = elRect.top + intersection[1] - widgetRect.y / scale + "px";
|
||||
const clipWidth = intersection[2] + "px";
|
||||
const clipHeight = intersection[3] + "px";
|
||||
@ -262,8 +262,8 @@ LGraphNode.prototype.addDOMWidget = function (name, type, element, options) {
|
||||
Object.assign(element.style, {
|
||||
transformOrigin: "0 0",
|
||||
transform: scale,
|
||||
left: `${transform.a + transform.e}px`,
|
||||
top: `${transform.d + transform.f + + elRect.top}px`,
|
||||
left: `${transform.a + transform.e + elRect.left}px`,
|
||||
top: `${transform.d + transform.f + elRect.top}px`,
|
||||
width: `${widgetWidth - margin * 2}px`,
|
||||
height: `${(widget.computedHeight ?? 50) - margin * 2}px`,
|
||||
position: "absolute",
|
||||
|
||||
@ -130,6 +130,8 @@
|
||||
gap: 8px;
|
||||
box-sizing: border-box;
|
||||
z-index: 1000;
|
||||
order: 0;
|
||||
grid-column: 1/-1;
|
||||
}
|
||||
|
||||
.comfyui-menu>* {
|
||||
@ -318,7 +320,7 @@
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.comfyui-workflows-open li:first-of-type {
|
||||
.comfyui-workflows-open .active {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@ -361,6 +363,7 @@
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.comfyui-workflows-tree-file.active::before,
|
||||
.comfyui-workflows-tree li:hover::before,
|
||||
.comfyui-workflows-tree-file:hover::before {
|
||||
content: "";
|
||||
@ -373,6 +376,11 @@
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.comfyui-workflows-tree-file.active::before {
|
||||
background-color: var(--primary-bg);
|
||||
color: var(--primary-fg);
|
||||
}
|
||||
|
||||
.comfyui-workflows-tree-file.running:not(:hover)::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
|
||||
@ -368,6 +368,9 @@ export class ComfyWorkflowsContent {
|
||||
if (w.unsaved) {
|
||||
wrapper.element.classList.add("unsaved");
|
||||
}
|
||||
if(w === this.app.workflowManager.activeWorkflow) {
|
||||
wrapper.element.classList.add("active");
|
||||
}
|
||||
|
||||
this.openFiles.set(w, wrapper);
|
||||
return wrapper.element;
|
||||
|
||||
@ -20,6 +20,8 @@ export class ComfyWorkflowManager extends EventTarget {
|
||||
/** @type {string | null} */
|
||||
#activePromptId = null;
|
||||
#unsavedCount = 0;
|
||||
#activeWorkflow;
|
||||
|
||||
/** @type {Record<string, ComfyWorkflow>} */
|
||||
workflowLookup = {};
|
||||
/** @type {Array<ComfyWorkflow>} */
|
||||
@ -30,7 +32,7 @@ export class ComfyWorkflowManager extends EventTarget {
|
||||
queuedPrompts = {};
|
||||
|
||||
get activeWorkflow() {
|
||||
return this.openWorkflows[0];
|
||||
return this.#activeWorkflow ?? this.openWorkflows[0];
|
||||
}
|
||||
|
||||
get activePromptId() {
|
||||
@ -145,14 +147,13 @@ export class ComfyWorkflowManager extends EventTarget {
|
||||
}
|
||||
|
||||
const index = this.openWorkflows.indexOf(workflow);
|
||||
if (index !== -1) {
|
||||
// Swapping to an open workflow
|
||||
this.openWorkflows.unshift(this.openWorkflows.splice(index, 1)[0]);
|
||||
} else {
|
||||
if (index === -1) {
|
||||
// Opening a new workflow
|
||||
this.openWorkflows.unshift(workflow);
|
||||
this.openWorkflows.push(workflow);
|
||||
}
|
||||
|
||||
this.#activeWorkflow = workflow;
|
||||
|
||||
setStorageValue("Comfy.PreviousWorkflow", this.activeWorkflow.path ?? "");
|
||||
this.dispatchEvent(new CustomEvent("changeWorkflow"));
|
||||
}
|
||||
@ -203,7 +204,8 @@ export class ComfyWorkflowManager extends EventTarget {
|
||||
workflow.changeTracker = null;
|
||||
this.openWorkflows.splice(this.openWorkflows.indexOf(workflow), 1);
|
||||
if (this.openWorkflows.length) {
|
||||
await this.openWorkflows[0].load();
|
||||
this.#activeWorkflow = this.openWorkflows[0];
|
||||
await this.#activeWorkflow.load();
|
||||
} else {
|
||||
// Load default
|
||||
await this.app.loadGraphData();
|
||||
|
||||
@ -40,13 +40,37 @@ body {
|
||||
overflow: hidden;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--fg-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
grid-template-rows: auto auto 1fr auto;
|
||||
}
|
||||
|
||||
.comfyui-body-top {
|
||||
order: 0;
|
||||
grid-column: 1/-1;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.comfyui-body-left {
|
||||
order: 1;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#graph-canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.comfyui-body-right {
|
||||
order: 3;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.comfyui-body-bottom {
|
||||
order: 4;
|
||||
grid-column: 1/-1;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.comfy-multiline-input {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user