From 9ed547bc4fa80a5e0566ac2b39f1c0885916c685 Mon Sep 17 00:00:00 2001 From: gitstart Date: Thu, 8 Dec 2022 05:11:25 +0000 Subject: [PATCH] chore: changed the function name --- code/addons/measure/src/withMeasure.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/addons/measure/src/withMeasure.ts b/code/addons/measure/src/withMeasure.ts index a041d875796..8a6b2a41489 100644 --- a/code/addons/measure/src/withMeasure.ts +++ b/code/addons/measure/src/withMeasure.ts @@ -17,7 +17,7 @@ export const withMeasure = (StoryFn: StoryFunction, context: StoryCont const { measureEnabled } = context.globals; useEffect(() => { - const onMouseMove = (event: MouseEvent) => { + const onPointerMove = (event: MouseEvent) => { window.requestAnimationFrame(() => { event.stopPropagation(); pointer.x = event.clientX; @@ -25,15 +25,15 @@ export const withMeasure = (StoryFn: StoryFunction, context: StoryCont }); }; - document.addEventListener('pointermove', onMouseMove); + document.addEventListener('pointermove', onPointerMove); return () => { - document.removeEventListener('pointermove', onMouseMove); + document.removeEventListener('pointermove', onPointerMove); }; }, []); useEffect(() => { - const onMouseOver = (event: MouseEvent) => { + const onPointerOver = (event: MouseEvent) => { window.requestAnimationFrame(() => { event.stopPropagation(); findAndDrawElement(event.clientX, event.clientY); @@ -47,7 +47,7 @@ export const withMeasure = (StoryFn: StoryFunction, context: StoryCont }; if (measureEnabled) { - document.addEventListener('pointerover', onMouseOver); + document.addEventListener('pointerover', onPointerOver); init(); window.addEventListener('resize', onResize); // Draw the element below the pointer when first enabled