mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-22 05:02:11 -03:00
Add addLayers method to BatchPreviewManager
Introduces an addLayers method to BatchPreviewManager for adding new layers to an active batch preview or showing the UI if inactive. Updates Canvas to use addLayers instead of show, and fixes a bug where new layers were only added if more than one was present.
This commit is contained in:
@@ -134,6 +134,22 @@ export class BatchPreviewManager {
|
||||
this.canvas.render();
|
||||
}
|
||||
|
||||
addLayers(newLayers) {
|
||||
if (!newLayers || newLayers.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.active) {
|
||||
// UI is already open, just add the new layers
|
||||
log.info(`Adding ${newLayers.length} new layers to active batch preview.`);
|
||||
this.layers.push(...newLayers);
|
||||
this._update();
|
||||
} else {
|
||||
// UI is not open, show it with the new layers
|
||||
this.show(newLayers);
|
||||
}
|
||||
}
|
||||
|
||||
navigate(direction) {
|
||||
this.currentIndex += direction;
|
||||
if (this.currentIndex < 0) {
|
||||
|
||||
@@ -493,8 +493,8 @@ export class Canvas {
|
||||
log.info('Auto-refresh triggered, importing latest images.');
|
||||
const newLayers = await this.canvasIO.importLatestImages(lastExecutionStartTime);
|
||||
|
||||
if (newLayers && newLayers.length > 1) {
|
||||
this.batchPreviewManager.show(newLayers);
|
||||
if (newLayers && newLayers.length > 0) {
|
||||
this.batchPreviewManager.addLayers(newLayers);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user