mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-26 06:45:44 -03:00
Fix Ctrl+V to paste from system clipboard when internal clipboard is empty
This commit is contained in:
@@ -575,10 +575,8 @@ export class CanvasInteractions {
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
// Paste layers from internal clipboard
|
||||
if (this.canvas.canvasLayers.internalClipboard.length > 0) {
|
||||
this.canvas.canvasLayers.pasteLayers();
|
||||
}
|
||||
// Paste from internal clipboard or system clipboard
|
||||
this.canvas.canvasLayers.handlePaste('mouse');
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
|
||||
@@ -360,7 +360,7 @@ export class CanvasInteractions {
|
||||
if (grabIconLayer) {
|
||||
// Start dragging the selected layer(s) without changing selection
|
||||
this.interaction.mode = 'potential-drag';
|
||||
this.interaction.dragStart = {...coords.world};
|
||||
this.interaction.dragStart = { ...coords.world };
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -704,10 +704,8 @@ export class CanvasInteractions {
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
// Paste layers from internal clipboard
|
||||
if (this.canvas.canvasLayers.internalClipboard.length > 0) {
|
||||
this.canvas.canvasLayers.pasteLayers();
|
||||
}
|
||||
// Paste from internal clipboard or system clipboard
|
||||
this.canvas.canvasLayers.handlePaste('mouse');
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
@@ -844,7 +842,7 @@ export class CanvasInteractions {
|
||||
originalHeight: layer.originalHeight,
|
||||
cropBounds: layer.cropBounds ? { ...layer.cropBounds } : undefined
|
||||
};
|
||||
this.interaction.dragStart = {...worldCoords};
|
||||
this.interaction.dragStart = { ...worldCoords };
|
||||
|
||||
if (handle === 'rot') {
|
||||
this.interaction.mode = 'rotating';
|
||||
@@ -880,7 +878,7 @@ export class CanvasInteractions {
|
||||
}
|
||||
|
||||
this.interaction.mode = 'potential-drag';
|
||||
this.interaction.dragStart = {...worldCoords};
|
||||
this.interaction.dragStart = { ...worldCoords };
|
||||
}
|
||||
|
||||
startPanning(e: MouseEvent, clearSelection: boolean = true): void {
|
||||
@@ -896,8 +894,8 @@ export class CanvasInteractions {
|
||||
this.interaction.mode = 'resizingCanvas';
|
||||
const startX = snapToGrid(worldCoords.x);
|
||||
const startY = snapToGrid(worldCoords.y);
|
||||
this.interaction.canvasResizeStart = {x: startX, y: startY};
|
||||
this.interaction.canvasResizeRect = {x: startX, y: startY, width: 0, height: 0};
|
||||
this.interaction.canvasResizeStart = { x: startX, y: startY };
|
||||
this.interaction.canvasResizeRect = { x: startX, y: startY, width: 0, height: 0 };
|
||||
this.canvas.render();
|
||||
}
|
||||
|
||||
@@ -949,7 +947,7 @@ export class CanvasInteractions {
|
||||
const dy = e.clientY - this.interaction.panStart.y;
|
||||
this.canvas.viewport.x -= dx / this.canvas.viewport.zoom;
|
||||
this.canvas.viewport.y -= dy / this.canvas.viewport.zoom;
|
||||
this.interaction.panStart = {x: e.clientX, y: e.clientY};
|
||||
this.interaction.panStart = { x: e.clientX, y: e.clientY };
|
||||
|
||||
// Update stroke overlay if mask tool is drawing during pan
|
||||
if (this.canvas.maskTool.isDrawing) {
|
||||
@@ -1106,9 +1104,9 @@ export class CanvasInteractions {
|
||||
} else newCropBounds.height += delta_image_y;
|
||||
}
|
||||
|
||||
// Clamp crop bounds to stay within the original image and maintain minimum size
|
||||
// Clamp crop bounds to stay within the original image and maintain minimum size
|
||||
if (newCropBounds.width < 1) {
|
||||
if (handle?.includes('w')) newCropBounds.x = o.cropBounds.x + o.cropBounds.width -1;
|
||||
if (handle?.includes('w')) newCropBounds.x = o.cropBounds.x + o.cropBounds.width - 1;
|
||||
newCropBounds.width = 1;
|
||||
}
|
||||
if (newCropBounds.height < 1) {
|
||||
|
||||
Reference in New Issue
Block a user