Refactor and add new gamepad action binding handling in App.tsx

This commit is contained in:
2026-04-11 18:40:43 +02:00
parent cfa5e6c25a
commit 4fcb5268d8

View File

@@ -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
) => {