Skip to content

Commit 8147f9f

Browse files
committed
Fix resizing issue exiting full srceen mode (HistoryChart)
1 parent 93f9703 commit 8147f9f

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

packages/modules/web_themes/koala/source/src/components/ChartCarousel.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
class="full-width full-height bg-transparent carousel-height"
1313
>
1414
<q-carousel-slide
15-
v-for="(chartComponent, index) in chartCarouselItems"
16-
:key="index"
15+
v-for="chartComponent in chartCarouselItems"
16+
:key="`${chartComponent.name}-${chartComponent.name === 'HistoryChart' ? renderKey : 0}`"
1717
:name="chartComponent.name"
1818
>
1919
<component :is="chartComponent.component" :show-legend="legendVisible" />
@@ -42,7 +42,7 @@
4242
</template>
4343

4444
<script setup lang="ts">
45-
import { ref, computed } from 'vue';
45+
import { ref, computed, watch } from 'vue';
4646
import { useQuasar } from 'quasar';
4747
import EnergyFlowChart from './charts/energyFlowChart/EnergyFlowChart.vue';
4848
import HistoryChart from './charts/historyChart/HistoryChart.vue';
@@ -53,7 +53,7 @@ defineOptions({
5353
});
5454
const $q = useQuasar();
5555
const localDataStore = useLocalDataStore();
56-
56+
const renderKey = ref(0);
5757
const toggleLegend = () => {
5858
localDataStore.toggleLegendVisibility();
5959
};
@@ -70,6 +70,21 @@ const chartCarouselItems = [
7070
},
7171
];
7272
const currentSlide = ref<string>(chartCarouselItems[0].name);
73+
74+
watch(
75+
() => fullscreen.value,
76+
(isFullscreen, wasFullscreen) => {
77+
// Only trigger when exiting fullscreen and current slide is HistoryChart
78+
if (
79+
!isFullscreen &&
80+
wasFullscreen &&
81+
currentSlide.value === 'HistoryChart'
82+
) {
83+
// Force the chart to be recreated by changing its key
84+
renderKey.value++;
85+
}
86+
},
87+
);
7388
</script>
7489

7590
<style scoped>

0 commit comments

Comments
 (0)