From f1ac0f807af0c4215439e1a6cc18097f41c223b3 Mon Sep 17 00:00:00 2001 From: hustcc Date: Mon, 11 Dec 2023 16:30:56 +0800 Subject: [PATCH] chore: remove unused pointer event --- src/interaction/tooltip.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/interaction/tooltip.ts b/src/interaction/tooltip.ts index 7b32cf457b..6ceec7b2f0 100644 --- a/src/interaction/tooltip.ts +++ b/src/interaction/tooltip.ts @@ -685,7 +685,6 @@ export function seriesTooltip( ) as (...args: any[]) => void; const hide = (event: MouseEvent) => { - console.log(111, 'hide'); hideTooltip({ root, single, emitter, event }); if (crosshairs) hideRuleY(root); if (marker) hideMarker(root); @@ -853,23 +852,21 @@ export function tooltip( ) as (...args: any[]) => void; const pointerleave = (event) => { - // const { target: element } = event; - console.log(1112, 'leave'); - // if (!elementSet.has(element)) return; hideTooltip({ root, single, emitter, event }); }; const addEventListeners = () => { if (!disableNative) { - root.addEventListener('pointerover', pointerover); + console.log(111, 'addEventListeners'); root.addEventListener('pointermove', pointerover); + // Only emit pointerleave event when the pointer is not in the root area. + // !! !DO NOT USE pointerout event, it will emit when the pointer is in the child area. root.addEventListener('pointerleave', pointerleave); } }; const removeEventListeners = () => { if (!disableNative) { - root.removeEventListener('pointerover', pointerover); root.removeEventListener('pointermove', pointerover); root.removeEventListener('pointerleave', pointerleave); }