From edb799bf82556b8d8581be7d28be271a63d43c43 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Sat, 17 Feb 2024 00:35:41 -0600 Subject: [PATCH] VizTooltips: Fix drag-zoom causing annotation init in other shared-cursor panels (#82986) --- .../src/components/uPlot/plugins/TooltipPlugin2.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin2.tsx b/packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin2.tsx index e9590c434b2..3b755bc379f 100644 --- a/packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin2.tsx +++ b/packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin2.tsx @@ -341,8 +341,10 @@ export const TooltipPlugin2 = ({ }); config.addHook('setSelect', (u) => { - if (clientZoom || queryZoom != null) { - if (maybeZoomAction(u.cursor!.event)) { + let e = u.cursor!.event; + + if (e != null && (clientZoom || queryZoom != null)) { + if (maybeZoomAction(e)) { if (clientZoom && yDrag) { if (u.select.height >= MIN_ZOOM_DIST) { for (let key in u.scales!) {