From a768aa60d50ac2d5b6d76364f090724919807ba8 Mon Sep 17 00:00:00 2001 From: hvangeffen Date: Thu, 15 Feb 2024 09:27:59 +0100 Subject: [PATCH] Use active display type items as watch for tab switch --- .../spatialdisplay/SpatialTimeSeriesDisplay.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/spatialdisplay/SpatialTimeSeriesDisplay.vue b/src/components/spatialdisplay/SpatialTimeSeriesDisplay.vue index f911959f..9bd89b53 100644 --- a/src/components/spatialdisplay/SpatialTimeSeriesDisplay.vue +++ b/src/components/spatialdisplay/SpatialTimeSeriesDisplay.vue @@ -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(() => { const displayItems: DisplayTypeItem[] = [ @@ -165,6 +160,13 @@ const displayTypeItems = computed(() => { 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') }