mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-24 22:12:17 -03:00
Refactor canvas preview visibility and widget loading
Refactored Canvas.js to use an async waitForWidget method for reliably finding widgets before manipulating them. The setPreviewVisibility method is now async and simplified, with excessive debug logging removed. CanvasState.js now triggers a render after saving state. In CanvasView.js, initial state loading is deferred and preview visibility is managed in the Canvas constructor, removing redundant calls.
This commit is contained in:
@@ -1105,14 +1105,12 @@ async function createCanvasWidget(node, widget, app) {
|
||||
if (!window.canvasExecutionStates) {
|
||||
window.canvasExecutionStates = new Map();
|
||||
}
|
||||
|
||||
|
||||
node.canvasWidget = canvas;
|
||||
|
||||
console.log('Canvas widget element:', node.element);
|
||||
console.log('Canvas widget canvas:', node.canvas);
|
||||
console.log('Canvas widget parent:', node.parent);
|
||||
|
||||
setTimeout(() => {
|
||||
canvas.loadInitialState();
|
||||
}, 100);
|
||||
|
||||
|
||||
// Konfiguracja opcji ukrywania podglądu
|
||||
const showPreviewWidget = node.widgets.find(w => w.name === "show_preview");
|
||||
@@ -1134,11 +1132,12 @@ async function createCanvasWidget(node, widget, app) {
|
||||
node.setDirtyCanvas(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
// Podgląd jest automatycznie ukrywany w konstruktorze Canvas.js
|
||||
// Nie potrzebujemy już wywoływać setInitialPreviewVisibility
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
canvas.loadInitialState();
|
||||
}, 100);
|
||||
|
||||
|
||||
return {
|
||||
canvas: canvas,
|
||||
|
||||
Reference in New Issue
Block a user