From d1004d58645d2d90c353ea4fd6b443369c4f9921 Mon Sep 17 00:00:00 2001 From: Dariusz L Date: Wed, 2 Jul 2025 10:16:59 +0200 Subject: [PATCH] Notify layers panel on layer changes Added calls to canvasLayersPanel.onLayersChanged() after pasting, adding, and fusing layers to ensure the layers panel updates its view in response to these actions. --- js/CanvasLayers.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/js/CanvasLayers.js b/js/CanvasLayers.js index 1077139..a82433e 100644 --- a/js/CanvasLayers.js +++ b/js/CanvasLayers.js @@ -128,6 +128,12 @@ export class CanvasLayers { this.canvas.updateSelection(newLayers); this.canvas.render(); + + // Notify the layers panel to update its view + if (this.canvas.canvasLayersPanel) { + this.canvas.canvasLayersPanel.onLayersChanged(); + } + log.info(`Pasted ${newLayers.length} layer(s) at mouse position (${mouseX}, ${mouseY}).`); } @@ -192,6 +198,11 @@ export class CanvasLayers { this.canvas.render(); this.canvas.saveState(); + // Notify the layers panel to update its view + if (this.canvas.canvasLayersPanel) { + this.canvas.canvasLayersPanel.onLayersChanged(); + } + log.info("Layer added successfully"); return layer; }, 'CanvasLayers.addLayerWithImage'); @@ -1158,6 +1169,11 @@ export class CanvasLayers { this.canvas.render(); this.canvas.saveState(); + // Notify the layers panel to update its view + if (this.canvas.canvasLayersPanel) { + this.canvas.canvasLayersPanel.onLayersChanged(); + } + log.info("Layers fused successfully", { originalLayerCount: sortedSelection.length, fusedDimensions: { width: fusedWidth, height: fusedHeight },