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:
Dariusz L
2025-07-03 11:52:16 +02:00
parent e5060fd8c3
commit d40f68b8c6
6 changed files with 137 additions and 38 deletions

View File

@@ -757,7 +757,7 @@ export class CanvasIO {
}
}
async importLatestImages(sinceTimestamp) {
async importLatestImages(sinceTimestamp, targetArea = null) {
try {
log.info(`Fetching latest images since ${sinceTimestamp}...`);
const response = await fetch(`/layerforge/get-latest-images/${sinceTimestamp}`);
@@ -774,7 +774,7 @@ export class CanvasIO {
img.onerror = reject;
img.src = imageData;
});
const newLayer = await this.canvas.canvasLayers.addLayerWithImage(img, {}, 'fit');
const newLayer = await this.canvas.canvasLayers.addLayerWithImage(img, {}, 'fit', targetArea);
newLayers.push(newLayer);
}
log.info("All new images imported and placed on canvas successfully.");