From e1a2420b5cfdc8af27f2aa5cae3d08f82590854b Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Tue, 5 Dec 2023 16:35:51 -0300 Subject: [PATCH] update layout automatically --- src/views/ConfigurationJoystickView.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/views/ConfigurationJoystickView.vue b/src/views/ConfigurationJoystickView.vue index 6bafe9a02..ce6254d41 100644 --- a/src/views/ConfigurationJoystickView.vue +++ b/src/views/ConfigurationJoystickView.vue @@ -56,7 +56,7 @@ class="w-[95%] p-4 shadow-md rounded-2xl flex-centered flex-column position-relative" >

{{ joystick.model }} controller

-
+
Update mapping {{ action.name }} @@ -256,9 +257,11 @@ import { JoystickButton, JoystickButtonInput, JoystickProtocol, +type ProtocolAction, } from '@/types/joystick' import BaseConfigurationView from './BaseConfigurationView.vue' +import { nextTick } from 'vue' const controllerStore = useControllerStore() @@ -278,7 +281,7 @@ const justRemappedInput = ref() const inputClickedDialog = ref(false) const currentModifierKey = ref(modifierKeyActions.regular) const availableModifierKeys = Object.values(modifierKeyActions) - +const showJoystickLayout = ref(true) watch(inputClickedDialog, () => (justRemappedInput.value = undefined)) const setCurrentInputs = (joystick: Joystick, inputs: JoystickInput[]): void => { @@ -335,6 +338,12 @@ const currentButtonActions = computed( () => controllerStore.protocolMapping.buttonsCorrespondencies[currentModifierKey.value.id as CockpitModifierKeyOption] ) +const updateButtonAction = (input: JoystickInput, action: ProtocolAction): void => { + controllerStore.protocolMapping.buttonsCorrespondencies[currentModifierKey.value.id as CockpitModifierKeyOption][input.id].action = action + showJoystickLayout.value = false + nextTick(() => (showJoystickLayout.value = true)) +} + // Automatically change between modifier key tabs/layouts when they are pressed watch(controllerStore.joysticks, () => { if (currentJoystick.value === undefined) {