UNPKG

@vue-material/core

Version:

Yet another 'Material Design Components' library for Vue3.

31 lines (29 loc) 981 B
import { Position } from '../utils/dom/events'; import { Ref } from 'vue'; type DragEventHandler = (e: TouchEvent | MouseEvent | PointerEvent) => void; type DragHandlerTuple = [ dragging: Readonly<Ref<boolean>>, handler: DragEventHandler ]; export declare function isTouch(event: Event): boolean; interface DragState extends Position { scrolledX: boolean; scrolledY: boolean; startX: number; startY: number; offsetX: number; offsetY: number; } interface DragEndState extends DragState { flingX: boolean; flingY: boolean; } type DragMoveHandler = (state: DragState, event: TouchEvent | MouseEvent) => void; type DragEndHandler = (state: DragEndState) => void; type DragHandlers = { move?: DragMoveHandler; end?: DragEndHandler; }; export declare function useDrag(callback: DragMoveHandler, prevent?: boolean): DragHandlerTuple; export declare function useDrag(handlers: DragHandlers, prevent?: boolean): DragHandlerTuple; export {};