mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Preserve batch generation area during canvas changes
Introduces a 'generationArea' context for batch image generation, ensuring that batch preview outlines and image placement remain accurate when the canvas is moved or resized. Updates related logic in Canvas, CanvasInteractions, CanvasLayers, and CanvasRenderer to track and render the correct area, and synchronizes context updates across user interactions.
This commit is contained in:
@@ -3,7 +3,7 @@ import {createModuleLogger} from "./utils/LoggerUtils.js";
|
||||
const log = createModuleLogger('BatchPreviewManager');
|
||||
|
||||
export class BatchPreviewManager {
|
||||
constructor(canvas, initialPosition = { x: 0, y: 0 }) {
|
||||
constructor(canvas, initialPosition = { x: 0, y: 0 }, generationArea = null) {
|
||||
this.canvas = canvas;
|
||||
this.active = false;
|
||||
this.layers = [];
|
||||
@@ -16,6 +16,7 @@ export class BatchPreviewManager {
|
||||
this.worldX = initialPosition.x;
|
||||
this.worldY = initialPosition.y;
|
||||
this.isDragging = false;
|
||||
this.generationArea = generationArea; // Store the generation area
|
||||
}
|
||||
|
||||
updateScreenPosition(viewport) {
|
||||
@@ -185,6 +186,9 @@ export class BatchPreviewManager {
|
||||
this.canvas.batchPreviewManagers.splice(index, 1);
|
||||
}
|
||||
|
||||
// Trigger a final render to ensure the generation area outline is removed
|
||||
this.canvas.render();
|
||||
|
||||
// Restore mask visibility if it was hidden by this manager
|
||||
if (this.maskWasVisible && !this.canvas.maskTool.isOverlayVisible) {
|
||||
this.canvas.maskTool.toggleOverlayVisibility();
|
||||
|
||||
Reference in New Issue
Block a user