Skip to content

Commit

Permalink
joytick-configuration: Only show one protocol panel at a given time
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl authored and ArturoManzoli committed Oct 15, 2024
1 parent 16819a6 commit 5185b1d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/components/ExpansiblePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ const warningContent = ref<HTMLElement | null>(null)
const animateWarning = ref(true)
const showElevationEffect = ref(isPanelExpanded.value || false)
const emit = defineEmits(['update:isExpanded'])
const togglePanel = (): void => {
if (isPanelExpanded.value) {
isPanelExpanded.value = false
Expand All @@ -189,6 +191,7 @@ const togglePanel = (): void => {
showElevationEffect.value = true
isPanelExpanded.value = true
}
emit('update:isExpanded', isPanelExpanded.value)
}
const textSize = computed(() => {
Expand Down
17 changes: 15 additions & 2 deletions src/views/ConfigurationJoystickView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@
mark-expanded
darken-content
hover-effect
:is-expanded="protocol === JoystickProtocol.MAVLinkManualControl"
:is-expanded="protocol === protocolToExpand"
@update:is-expanded="(isExpanded: boolean) => reactToPanelExpansion(isExpanded, protocol)"
>
<template #title>
{{ protocol }}
Expand Down Expand Up @@ -549,7 +550,7 @@
</template>
<template #actions>
<div class="flex justify-end w-full">
<v-btn variant="text" class="m-1" @click="inputClickedDialog = false"> Close </v-btn>
<v-btn variant="text" class="m-1" @click="closeInputMappingDialog"> Close </v-btn>
</div>
</template>
</InteractionDialog>
Expand Down Expand Up @@ -818,4 +819,16 @@ const vehicleTypesAssignedToCurrentProfile = computed({
})
},
})
const protocolToExpand = ref<JoystickProtocol | undefined>(undefined)
const reactToPanelExpansion = (isExpanded: boolean, protocol: JoystickProtocol): void => {
console.log(`${protocol} is expanded: ${isExpanded}`)
protocolToExpand.value = isExpanded ? protocol : undefined
}
const closeInputMappingDialog = (): void => {
inputClickedDialog.value = false
protocolToExpand.value = undefined
}
</script>

0 comments on commit 5185b1d

Please sign in to comment.