Add 'fit on add' option for image placement

Introduces a 'fit_on_add' boolean option to control whether images are fit to the canvas when added or pasted. Updates image addition and paste logic in Canvas, CanvasLayers, and CanvasView to support new placement modes ('fit', 'center', 'mouse', 'default').
This commit is contained in:
Dariusz L
2025-06-28 19:48:57 +02:00
parent 8ead4176b5
commit 4376a21147
4 changed files with 42 additions and 25 deletions

View File

@@ -157,8 +157,8 @@ export class Canvas {
return this.canvasLayers.pasteLayers();
}
async handlePaste(pasteMode) {
return this.canvasLayers.handlePaste(pasteMode);
async handlePaste(addMode) {
return this.canvasLayers.handlePaste(addMode);
}
@@ -194,13 +194,13 @@ export class Canvas {
return this.canvasLayers.isRotationHandle(x, y);
}
async addLayerWithImage(image, layerProps = {}) {
return this.canvasLayers.addLayerWithImage(image, layerProps);
async addLayerWithImage(image, layerProps = {}, addMode = 'default') {
return this.canvasLayers.addLayerWithImage(image, layerProps, addMode);
}
async addLayer(image) {
return this.addLayerWithImage(image);
async addLayer(image, addMode = 'default') {
return this.addLayerWithImage(image, {}, addMode);
}
async removeLayer(index) {