From b0790063b27b41a1f942ff125ce55c0e27ecc9e3 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 15 Aug 2023 14:22:19 +0300 Subject: [PATCH] Geomap: Fix crosshair glitch (#72909) --- public/app/plugins/panel/geomap/layers/data/routeLayer.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/geomap/layers/data/routeLayer.tsx b/public/app/plugins/panel/geomap/layers/data/routeLayer.tsx index 229979bb1eb..29f698b48c5 100644 --- a/public/app/plugins/panel/geomap/layers/data/routeLayer.tsx +++ b/public/app/plugins/panel/geomap/layers/data/routeLayer.tsx @@ -317,14 +317,14 @@ function findNearestTimeIndex(timestamps: number[], time: number): number | null if (time < timestamps[probableIdx]) { for (let i = probableIdx; i > 0; i--) { if (time > timestamps[i]) { - return i; + return i < lastIdx ? i + 1 : lastIdx; } } return 0; } else { for (let i = probableIdx; i < lastIdx; i++) { if (time < timestamps[i]) { - return i; + return i > 0 ? i - 1 : 0; } } return lastIdx;