From aebfe4984595d0c08deff98748a6e262700ae28b Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Thu, 7 Dec 2023 14:54:11 -0300 Subject: [PATCH] joystick-config-view: Improve feedback on input remapping --- src/views/ConfigurationJoystickView.vue | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/views/ConfigurationJoystickView.vue b/src/views/ConfigurationJoystickView.vue index e082dc598..fcb610e7a 100644 --- a/src/views/ConfigurationJoystickView.vue +++ b/src/views/ConfigurationJoystickView.vue @@ -126,7 +126,12 @@ > {{ remappingInput ? 'Remapping' : 'Click to remap' }} -

{{ buttonRemappingText }}

+ +

{{ buttonRemappingText }}

+
+ + +
@@ -151,6 +156,11 @@
+ +

+ {{ buttonFunctionAssignmentFeedback }} +

+

Axis mapping

@@ -233,6 +243,10 @@ const currentJoystick = ref() const currentButtonInputs = ref([]) const currentAxisInputs = ref([]) const remappingInput = ref(false) +const remapTimeProgress = ref() +const showButtonRemappingText = ref(false) +const buttonFunctionAssignmentFeedback = ref('') +const showButtonFunctionAssignmentFeedback = ref(false) const justRemappedInput = ref() const inputClickedDialog = ref(false) const currentModifierKey = ref(modifierKeyActions.regular) @@ -268,6 +282,8 @@ const remapInput = async (joystick: Joystick, input: JoystickInput): Promise button.value === 1) await new Promise((r) => setTimeout(r, 100)) millisPassed += 100 + remapTimeProgress.value = 100 * (millisPassed / waitingTime) } // End the remapping process remappingInput.value = false + setTimeout(() => (showButtonRemappingText.value = false), 5000) + // If a button was pressed, update the mapping of that joystick model in the controller store and return if (![undefined, -1].includes(pressedButtonIndex)) { justRemappedInput.value = true @@ -300,6 +319,9 @@ const updateButtonAction = (input: JoystickInput, action: ProtocolAction): void ].action = action showJoystickLayout.value = false nextTick(() => (showJoystickLayout.value = true)) + buttonFunctionAssignmentFeedback.value = `Button ${input.id} remapped to function '${action.name}'.` + showButtonFunctionAssignmentFeedback.value = true + setTimeout(() => (showButtonFunctionAssignmentFeedback.value = false), 5000) } // Automatically change between modifier key tabs/layouts when they are pressed