Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion frontend/src/io-managers/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
});
}

Expand Down