mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 06:41:17 +08:00
chore: changed the function name
This commit is contained in:
parent
b467894eea
commit
9ed547bc4f
@ -17,7 +17,7 @@ export const withMeasure = (StoryFn: StoryFunction<Renderer>, 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<Renderer>, 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<Renderer>, 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user