reaviz
Version:
Data Visualization using React
21 lines (20 loc) • 869 B
TypeScript
import { PointerEvent } from 'react';
export interface HoverIntentOptions {
interval?: number;
sensitivity?: number;
timeout?: number;
disabled?: boolean;
onPointerOver: (event: PointerEvent<SVGElement>) => void;
onPointerOut: (event: PointerEvent<SVGElement>) => void;
}
export interface HoverIntentResult {
pointerOut: (event: PointerEvent<SVGElement>) => void;
pointerOver: (event: PointerEvent<SVGElement>) => void;
}
/**
* Hover intent identifies if the user actually is
* intending to over by measuring the position of the mouse
* once a pointer enters and determining if in a duration if
* the mouse moved inside a certain threshold and fires the events.
*/
export declare const useHoverIntent: ({ sensitivity, interval, timeout, disabled, onPointerOver, onPointerOut }: HoverIntentOptions | undefined) => HoverIntentResult;