mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Add layer visibility toggle and icon support
Introduces a 'visible' property to layers and updates all relevant logic to support toggling layer visibility. Adds visibility toggle icons to the layers panel using a new IconLoader utility, with SVG and fallback canvas icons. Updates rendering, selection, and batch preview logic to respect layer visibility. Also improves blend mode menu UI and ensures new/pasted layers are always added on top with correct z-index.
This commit is contained in:
20
js/Canvas.js
20
js/Canvas.js
@@ -319,6 +319,26 @@ export class Canvas {
|
||||
layer.y -= finalY;
|
||||
});
|
||||
this.maskTool.updatePosition(-finalX, -finalY);
|
||||
// Update batch preview managers like in canvas resize/move operations
|
||||
if (this.pendingBatchContext) {
|
||||
this.pendingBatchContext.outputArea.x -= finalX;
|
||||
this.pendingBatchContext.outputArea.y -= finalY;
|
||||
// Also update the menu spawn position to keep it relative
|
||||
this.pendingBatchContext.spawnPosition.x -= finalX;
|
||||
this.pendingBatchContext.spawnPosition.y -= finalY;
|
||||
log.debug("Updated pending batch context during shape definition:", this.pendingBatchContext);
|
||||
}
|
||||
// Also move any active batch preview menus
|
||||
if (this.batchPreviewManagers && this.batchPreviewManagers.length > 0) {
|
||||
this.batchPreviewManagers.forEach((manager) => {
|
||||
manager.worldX -= finalX;
|
||||
manager.worldY -= finalY;
|
||||
if (manager.generationArea) {
|
||||
manager.generationArea.x -= finalX;
|
||||
manager.generationArea.y -= finalY;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.viewport.x -= finalX;
|
||||
this.viewport.y -= finalY;
|
||||
this.saveState();
|
||||
|
||||
Reference in New Issue
Block a user