Skip to content

Commit

Permalink
Use active display type items as watch for tab switch
Browse files Browse the repository at this point in the history
  • Loading branch information
hvangeffen authored and wkramer committed Jun 19, 2024
1 parent e4ed16e commit a768aa6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/spatialdisplay/SpatialTimeSeriesDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ interface DisplayTypeItem {
value: DisplayType
}

watch(elevationChartDisplayconfig, () => {
if (displayType.value === DisplayType.ElevationChart) {
displayType.value = DisplayType.TimeSeriesChart
}
})
const displayType = ref(DisplayType.TimeSeriesChart)
const displayTypeItems = computed<DisplayTypeItem[]>(() => {
const displayItems: DisplayTypeItem[] = [
Expand All @@ -165,6 +160,13 @@ const displayTypeItems = computed<DisplayTypeItem[]>(() => {
return displayItems
})

watch(displayTypeItems, () => {
const activeItems = displayTypeItems.value.map((dt) => dt.value)
if (!activeItems.includes(displayType.value)) {
displayType.value = activeItems[0]
}
})

function onClose(): void {
emit('close')
}
Expand Down

0 comments on commit a768aa6

Please sign in to comment.