New menu fixes - fix send to workflow (#3909)

* Fix send to workflow
Fix center align of close workflow dialog
Better support for elements around canvas

* More resilent to extra elements added to body
This commit is contained in:
pythongosssss 2024-07-14 07:04:40 +01:00 committed by GitHub
parent a3dffc447a
commit 79547efb65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 9 deletions

View File

@ -182,6 +182,11 @@ export class ComfyWorkflowsMenu {
* @param {ComfyWorkflow} workflow * @param {ComfyWorkflow} workflow
*/ */
async function sendToWorkflow(img, workflow) { async function sendToWorkflow(img, workflow) {
const openWorkflow = app.workflowManager.openWorkflows.find((w) => w.path === workflow.path);
if (openWorkflow) {
workflow = openWorkflow;
}
await workflow.load(); await workflow.load();
let options = []; let options = [];
const nodes = app.graph.computeExecutionOrder(false); const nodes = app.graph.computeExecutionOrder(false);
@ -214,7 +219,8 @@ export class ComfyWorkflowsMenu {
nodeType.prototype["getExtraMenuOptions"] = function (_, options) { nodeType.prototype["getExtraMenuOptions"] = function (_, options) {
const r = getExtraMenuOptions?.apply?.(this, arguments); const r = getExtraMenuOptions?.apply?.(this, arguments);
if (app.ui.settings.getSettingValue("Comfy.UseNewMenu", false) === true) { const setting = app.ui.settings.getSettingValue("Comfy.UseNewMenu", false);
if (setting && setting != "Disabled") {
const t = /** @type { {imageIndex?: number, overIndex?: number, imgs: string[]} } */ /** @type {any} */ (this); const t = /** @type { {imageIndex?: number, overIndex?: number, imgs: string[]} } */ /** @type {any} */ (this);
let img; let img;
if (t.imageIndex != null) { if (t.imageIndex != null) {

View File

@ -41,7 +41,7 @@ body {
background-color: var(--bg-color); background-color: var(--bg-color);
color: var(--fg-color); color: var(--fg-color);
grid-template-columns: auto 1fr auto; grid-template-columns: auto 1fr auto;
grid-template-rows: auto auto 1fr auto; grid-template-rows: auto 1fr auto;
min-height: -webkit-fill-available; min-height: -webkit-fill-available;
max-height: -webkit-fill-available; max-height: -webkit-fill-available;
min-width: -webkit-fill-available; min-width: -webkit-fill-available;
@ -49,32 +49,37 @@ body {
} }
.comfyui-body-top { .comfyui-body-top {
order: 0; order: -5;
grid-column: 1/-1; grid-column: 1/-1;
z-index: 10; z-index: 10;
display: flex;
flex-direction: column;
} }
.comfyui-body-left { .comfyui-body-left {
order: 1; order: -4;
z-index: 10; z-index: 10;
display: flex;
} }
#graph-canvas { #graph-canvas {
width: 100%; width: 100%;
height: 100%; height: 100%;
order: 2; order: -3;
grid-column: 1/-1;
} }
.comfyui-body-right { .comfyui-body-right {
order: 3; order: -2;
z-index: 10; z-index: 10;
display: flex;
} }
.comfyui-body-bottom { .comfyui-body-bottom {
order: 4; order: -1;
grid-column: 1/-1; grid-column: 1/-1;
z-index: 10; z-index: 10;
display: flex;
flex-direction: column;
} }
.comfy-multiline-input { .comfy-multiline-input {
@ -408,8 +413,12 @@ dialog::backdrop {
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
} }
.comfy-dialog.comfyui-dialog { .comfy-dialog.comfyui-dialog.comfy-modal {
top: 0; top: 0;
left: 0;
right: 0;
bottom: 0;
transform: none;
} }
.comfy-dialog.comfy-modal { .comfy-dialog.comfy-modal {