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:
Dariusz L
2025-07-26 21:20:18 +02:00
parent ca9e1890c4
commit f329a6ded5
7 changed files with 90 additions and 98 deletions

View File

@@ -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
};