From 546f78000685db1a7635c49c487601aff8c858ab Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 19 Sep 2024 11:50:25 +0200 Subject: [PATCH] UI: Disallow sub-second zoom as this cause inconsistenices in the X axis in uPlot Fixes #9135 Signed-off-by: Julien --- web/ui/mantine-ui/src/pages/query/uPlotChartHelpers.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web/ui/mantine-ui/src/pages/query/uPlotChartHelpers.ts b/web/ui/mantine-ui/src/pages/query/uPlotChartHelpers.ts index b7a81831c..e9dad3665 100644 --- a/web/ui/mantine-ui/src/pages/query/uPlotChartHelpers.ts +++ b/web/ui/mantine-ui/src/pages/query/uPlotChartHelpers.ts @@ -380,10 +380,11 @@ export const getUPlotOptions = ( hooks: { setSelect: [ (self: uPlot) => { - onSelectRange( - self.posToVal(self.select.left, "x"), - self.posToVal(self.select.left + self.select.width, "x") - ); + // Disallow sub-second zoom as this cause inconsistenices in the X axis in uPlot. + const leftVal = self.posToVal(self.select.left, "x"); + const rightVal = Math.max(self.posToVal(self.select.left + self.select.width, "x"), leftVal + 1); + + onSelectRange(leftVal, rightVal); }, ], },