UNPKG

@fleet-frontend/mower-maps

Version:

a mower maps in google maps

40 lines 1.34 kB
/** * 触摸事件工具函数 * 用于在H5环境下处理触摸事件,在Web环境下处理鼠标事件 */ import { PlatformType } from '@/types'; export interface UnifiedEvent { clientX: number; clientY: number; preventDefault: () => void; stopPropagation: () => void; target: EventTarget | null; currentTarget: EventTarget | null; } /** * 将触摸事件转换为统一的鼠标事件格式 */ export declare const normalizeTouchEvent: (event: TouchEvent | MouseEvent) => UnifiedEvent; /** * 根据平台获取正确的事件类型 */ export declare const getEventTypes: (platform: PlatformType) => { start: string; move: string; end: string; cancel: string; }; /** * 添加事件监听器(自动选择正确的事件类型) */ export declare const addEventListeners: (element: Element | Document, eventHandlers: { onStart?: (event: UnifiedEvent) => void; onMove?: (event: UnifiedEvent) => void; onEnd?: (event: UnifiedEvent) => void; onCancel?: (event: UnifiedEvent) => void; }, platform: PlatformType) => () => void; /** * 创建React事件处理器 */ export declare const createReactEventHandler: (handler: (event: UnifiedEvent) => void, platform: PlatformType) => (event: React.MouseEvent | React.TouchEvent) => void; //# sourceMappingURL=touchEvents.d.ts.map