This commit is contained in:
2025-11-23 17:26:14 +01:00
parent 551d7a027f
commit a76c0bd04d
2 changed files with 7 additions and 6 deletions

View File

@@ -261,14 +261,15 @@
const allowCellSwap = ref(false);
const getMousePosition = (event: MouseEvent, z: number) => {
const getMousePosition = (event: MouseEvent, z?: number) => {
if (!gridContainerRef.value) return null;
const currentZoom = z ?? zoom.value;
const rect = gridContainerRef.value.getBoundingClientRect();
const scaleX = gridContainerRef.value.offsetWidth / (rect.width / z);
const scaleY = gridContainerRef.value.offsetHeight / (rect.height / z);
const scaleX = gridContainerRef.value.offsetWidth / (rect.width / currentZoom);
const scaleY = gridContainerRef.value.offsetHeight / (rect.height / currentZoom);
return {
x: ((event.clientX - rect.left) / z) * scaleX,
y: ((event.clientY - rect.top) / z) * scaleY,
x: ((event.clientX - rect.left) / currentZoom) * scaleX,
y: ((event.clientY - rect.top) / currentZoom) * scaleY,
};
};

View File

@@ -31,7 +31,7 @@ export function useFileDrop(options: FileDropOptions) {
isDragOver.value = true;
};
const handleDragLeave = (event: DragEvent, canvasRef?: HTMLCanvasElement | null) => {
const handleDragLeave = (event: DragEvent, canvasRef?: HTMLElement | null) => {
event.preventDefault();
event.stopPropagation();