Skip to content

Commit

Permalink
fix: fix webcam switch button (#1589)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored Oct 7, 2023
1 parent 09a994d commit e445fbe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/panels/WebcamPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
:collapsible="$route.fullPath !== '/cam'"
card-class="webcam-panel"
:margin-bottom="currentPage !== 'page'">
<template v-if="webcams.length > 1" #buttons>
<v-menu :offset-y="true" title="Webcam">
<template #buttons>
<v-menu v-if="showSwitch" :offset-y="true">
<template #activator="{ on, attrs }">
<v-btn text tile v-bind="attrs" v-on="on">
<v-icon v-if="'icon' in currentCam" small class="mr-2">
Expand All @@ -33,7 +33,7 @@
<v-icon small class="mt-1">{{ convertWebcamIcon(webcam.icon) }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="webcam.name"></v-list-item-title>
<v-list-item-title v-text="webcam.name" />
</v-list-item-content>
</v-list-item>
</v-list>
Expand Down Expand Up @@ -77,6 +77,10 @@ export default class WebcamPanel extends Mixins(BaseMixin, WebcamMixin) {
return this.$store.getters['gui/webcams/getWebcams']
}
get showSwitch() {
return this.webcams.length > 1
}
// id changed to name with the refactoring of using moonraker webcam API
get currentCamId(): string {
if (this.webcams.length === 1) return this.webcams[0].name ?? 'all'
Expand Down

0 comments on commit e445fbe

Please sign in to comment.