fix keyboard handle input

This commit is contained in:
Orion Reed 2024-12-07 16:26:41 -05:00
parent 2b536ee188
commit 43eff5dfd4
1 changed files with 7 additions and 2 deletions

View File

@ -372,10 +372,15 @@ export class FolkShape extends HTMLElement {
}; };
const currentPos = rect.toParentSpace(HANDLE_TO_CORNER[handle]); const currentPos = rect.toParentSpace(HANDLE_TO_CORNER[handle]);
let delta = { x: 0, y: 0 };
if (event.key === 'ArrowRight') delta.x = MOVEMENT_DELTA;
if (event.key === 'ArrowLeft') delta.x = -MOVEMENT_DELTA;
if (event.key === 'ArrowDown') delta.y = MOVEMENT_DELTA;
if (event.key === 'ArrowUp') delta.y = -MOVEMENT_DELTA;
const syntheticMouse = { const syntheticMouse = {
x: currentPos.x, x: currentPos.x + delta.x,
y: currentPos.y, y: currentPos.y + delta.y,
}; };
// Calculate movement based on arrow keys // Calculate movement based on arrow keys