diff --git a/frontend/src/io-managers/input.ts b/frontend/src/io-managers/input.ts index 5e59559973..5dd6c29d39 100644 --- a/frontend/src/io-managers/input.ts +++ b/frontend/src/io-managers/input.ts @@ -36,6 +36,7 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli let canvasFocused = true; let inPointerLock = false; const shakeSamples: { x: number; y: number; time: number }[] = []; + let lastMousePosition: [number, number] | undefined; let lastShakeTime = 0; // Event listeners @@ -159,6 +160,8 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli function onPointerMove(e: PointerEvent) { potentiallyRestoreCanvasFocus(e); + lastMousePosition = [e.clientX, e.clientY]; + if (!e.buttons) viewportPointerInteractionOngoing = false; // Don't redirect pointer movement to the backend if there's no ongoing interaction and it's over a floating menu, or the graph overlay, on top of the canvas @@ -320,7 +323,7 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli Array.from(dataTransfer.items).forEach(async (item) => { if (item.type === "text/plain") item.getAsString((text) => editor.handle.pasteText(text)); - await pasteFile(item, editor); + await pasteFile(item, editor, lastMousePosition); }); }