mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Add world-space positioning and resizing for mask tool
Introduces x/y coordinates to MaskTool for world-space positioning, allowing the mask to extend beyond the output area. Updates mask drawing, export, and rendering logic to account for mask position. Ensures mask position is updated when moving or resizing the canvas, and preserves mask content during canvas resizing. Improves mask extraction and rendering accuracy.
This commit is contained in:
@@ -502,6 +502,10 @@ export class CanvasInteractions {
|
||||
layer.x -= finalX;
|
||||
layer.y -= finalY;
|
||||
});
|
||||
|
||||
// Update mask position when moving canvas
|
||||
this.canvas.maskTool.updatePosition(-finalX, -finalY);
|
||||
|
||||
this.canvas.viewport.x -= finalX;
|
||||
this.canvas.viewport.y -= finalY;
|
||||
}
|
||||
@@ -686,6 +690,9 @@ export class CanvasInteractions {
|
||||
layer.x -= rectX;
|
||||
layer.y -= rectY;
|
||||
});
|
||||
|
||||
// Update mask position when resizing canvas
|
||||
this.canvas.maskTool.updatePosition(-rectX, -rectY);
|
||||
|
||||
this.canvas.viewport.x -= rectX;
|
||||
this.canvas.viewport.y -= rectY;
|
||||
|
||||
Reference in New Issue
Block a user