mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-23 21:42:12 -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) {
|
||||
|
||||
Reference in New Issue
Block a user