UNPKG

@gravity-ui/graph

Version:

Modern graph editor component

24 lines (23 loc) 768 B
/** * Global trackpad detector instance for wheel events. * * Use this pre-configured detector to check if a wheel event originated from a trackpad * rather than a traditional mouse wheel. The detector maintains state across calls to provide * consistent results throughout a scroll session. * * @example * ```typescript * import { isTrackpadWheelEvent } from './utils/functions'; * * canvas.addEventListener('wheel', (event) => { * if (isTrackpadWheelEvent(event)) { * // Handle smooth trackpad scrolling * applyMomentumScrolling(event); * } else { * // Handle discrete mouse wheel steps * applySteppedScrolling(event); * } * }); * ``` */ export declare const isTrackpadWheelEvent: (e: WheelEvent, dpr?: number) => boolean;