diff --git a/js/BatchPreviewManager.js b/js/BatchPreviewManager.js index 7bd79c7..8989fef 100644 --- a/js/BatchPreviewManager.js +++ b/js/BatchPreviewManager.js @@ -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) { diff --git a/js/Canvas.js b/js/Canvas.js index 20bd719..d95e6b9 100644 --- a/js/Canvas.js +++ b/js/Canvas.js @@ -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); } } };