mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Refactor output area bounds handling for custom shapes
Output area bounds are now positioned relative to the world, not always at (0,0), and are updated to match custom shape placement. Rendering and extension logic have been updated to respect the new bounds, and the mask tool now adjusts to the output area position. Also sets log level to DEBUG for development.
This commit is contained in:
@@ -610,10 +610,12 @@ export class CustomShapeMenu {
|
||||
}
|
||||
_updateCanvasSize() {
|
||||
if (!this.canvas.outputAreaExtensionEnabled) {
|
||||
// Reset to original bounds when disabled
|
||||
// When extensions are disabled, preserve the current outputAreaBounds position
|
||||
// Only update the size to match originalCanvasSize
|
||||
const currentBounds = this.canvas.outputAreaBounds;
|
||||
this.canvas.outputAreaBounds = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
x: currentBounds.x, // ✅ Preserve current position
|
||||
y: currentBounds.y, // ✅ Preserve current position
|
||||
width: this.canvas.originalCanvasSize.width,
|
||||
height: this.canvas.originalCanvasSize.height
|
||||
};
|
||||
@@ -623,10 +625,11 @@ export class CustomShapeMenu {
|
||||
const ext = this.canvas.outputAreaExtensions;
|
||||
const newWidth = this.canvas.originalCanvasSize.width + ext.left + ext.right;
|
||||
const newHeight = this.canvas.originalCanvasSize.height + ext.top + ext.bottom;
|
||||
// Aktualizuj outputAreaBounds - "okno" w świecie które zostanie wyrenderowane
|
||||
// When extensions are enabled, calculate new bounds relative to current position
|
||||
const currentBounds = this.canvas.outputAreaBounds;
|
||||
this.canvas.outputAreaBounds = {
|
||||
x: -ext.left, // Może być ujemne - wycinamy fragment świata
|
||||
y: -ext.top, // Może być ujemne - wycinamy fragment świata
|
||||
x: currentBounds.x - ext.left, // Adjust position by left extension
|
||||
y: currentBounds.y - ext.top, // Adjust position by top extension
|
||||
width: newWidth,
|
||||
height: newHeight
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user