Skip to content

Commit

Permalink
fix: chart resize wizard closed
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmanNik committed Feb 10, 2023
1 parent fa5dff3 commit 156e052
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/charts/base.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import type { ECharts } from 'echarts/core';
import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
import type { EChartsOption } from 'echarts';
import { wizard } from '$lib/stores/wizard';
registerTheme('light', { ...base, ...light });
registerTheme('dark', { ...base, ...dark });
Expand Down Expand Up @@ -70,7 +71,7 @@
let timeoutId: unknown;
const onResize = () => {
if (timeoutId == undefined) {
if (timeoutId == undefined && !$wizard.show) {
timeoutId = setTimeout(() => {
if (chart && !chart.isDisposed()) {
chart.resize();
Expand All @@ -79,6 +80,10 @@
}, 250);
}
};
$: if (!$wizard.show) {
onResize();
}
</script>

<svelte:window on:resize={onResize} />
Expand Down

0 comments on commit 156e052

Please sign in to comment.