From 4fcb5268d884440bb48e446dab10bf43c2d5b59c Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 11 Apr 2026 18:40:43 +0200 Subject: [PATCH] Refactor and add new gamepad action binding handling in App.tsx --- src/app/App.tsx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index 003634b8..32e383f9 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -4190,7 +4190,7 @@ export function App({ store, initialStatusMessage }: AppProps) { }; const handlePlayerStartKeyboardBindingChange = ( - action: PlayerStartMovementAction, + action: PlayerStartInputAction, nextCode: PlayerStartKeyboardBindingCode ) => { const nextBindings = createPlayerStartInputBindings({ @@ -4209,7 +4209,7 @@ export function App({ store, initialStatusMessage }: AppProps) { ); }; - const handlePlayerStartGamepadBindingChange = ( + const handlePlayerStartMovementGamepadBindingChange = ( action: PlayerStartMovementAction, nextBinding: PlayerStartGamepadBinding ) => { @@ -4229,6 +4229,26 @@ export function App({ store, initialStatusMessage }: AppProps) { ); }; + const handlePlayerStartGamepadActionBindingChange = ( + action: PlayerStartLocomotionAction, + nextBinding: PlayerStartGamepadActionBinding + ) => { + const nextBindings = createPlayerStartInputBindings({ + keyboard: playerStartInputBindingsDraft.keyboard, + gamepad: { + ...playerStartInputBindingsDraft.gamepad, + [action]: nextBinding + } as PlayerStartInputBindings["gamepad"] + }); + + setPlayerStartInputBindingsDraft(nextBindings); + scheduleDraftCommit(() => + applyPlayerStartChange({ + inputBindings: nextBindings + }) + ); + }; + const handlePlayerStartGamepadCameraLookBindingChange = ( nextBinding: PlayerStartGamepadCameraLookBinding ) => {