fix zoom
Gitea Actions Demo / build_and_push (push) Successful in 1m14s Details

This commit is contained in:
artem 2026-09-26 22:41:23 +03:00
parent 02e96853f3
commit b17b67dc90
1 changed files with 6 additions and 1 deletions

View File

@ -523,6 +523,7 @@ type ChartRefEl = { chart: ChartJS };
// and are never re-rendered, so no Ref wrapper is needed. Using a bare array // and are never re-rendered, so no Ref wrapper is needed. Using a bare array
// also sidesteps deep generic instantiation of Ref<Array<{ chart: Chart }>>. // also sidesteps deep generic instantiation of Ref<Array<{ chart: Chart }>>.
const chartRefs: Array<ChartRefEl> = []; const chartRefs: Array<ChartRefEl> = [];
let pendingRezoom = false;
const group = new ChartGroup([]); const group = new ChartGroup([]);
const mapX = ref<Array<number>>([]); const mapX = ref<Array<number>>([]);
let currentCoordinates = ref<Array<number> | null>([]); let currentCoordinates = ref<Array<number> | null>([]);
@ -1172,7 +1173,10 @@ const setChartRef = (_key: string, el: unknown) => {
chartRefs.every((ref) => !!ref.chart) chartRefs.every((ref) => !!ref.chart)
) { ) {
group.charts = collectCharts(); group.charts = collectCharts();
if (pendingRezoom) {
pendingRezoom = false;
applySelectedRangeZoom(); applySelectedRangeZoom();
}
} else if (retries > 0) { } else if (retries > 0) {
nextTick(() => tryFinalize(retries - 1)); nextTick(() => tryFinalize(retries - 1));
} }
@ -1188,6 +1192,7 @@ const switchXAxis = (mode: XAxisMode) => {
chartRefs.length = 0; chartRefs.length = 0;
group.charts = []; group.charts = [];
xAxisMode.value = mode; xAxisMode.value = mode;
pendingRezoom = true;
}; };
onMounted(() => { onMounted(() => {
group.charts = collectCharts(); group.charts = collectCharts();