UI: Disallow sub-second zoom as this cause inconsistenices in the X axis in uPlot

Fixes #9135

Signed-off-by: Julien <roidelapluie@o11y.eu>
This commit is contained in:
Julien 2024-09-19 11:50:25 +02:00
parent b6107cc888
commit 546f780006
1 changed files with 5 additions and 4 deletions

View File

@ -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);
},
],
},