Merge pull request #14940 from roidelapluie/subsecondzoom

UI: Disallow sub-second zoom as this cause inconsistenices in the X axis in uPlot
This commit is contained in:
Julius Volz 2024-09-19 12:20:37 +02:00 committed by GitHub
commit c36589a6dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -380,10 +380,11 @@ export const getUPlotOptions = (
hooks: { hooks: {
setSelect: [ setSelect: [
(self: uPlot) => { (self: uPlot) => {
onSelectRange( // Disallow sub-second zoom as this cause inconsistenices in the X axis in uPlot.
self.posToVal(self.select.left, "x"), const leftVal = self.posToVal(self.select.left, "x");
self.posToVal(self.select.left + self.select.width, "x") const rightVal = Math.max(self.posToVal(self.select.left + self.select.width, "x"), leftVal + 1);
);
onSelectRange(leftVal, rightVal);
}, },
], ],
}, },