/** * 拖拽组件类 * @class Draggable * @description 为DOM元素添加拖拽功能的类,支持拖拽开始、拖拽中、拖拽结束的回调函数 * @example * const element = document.getElementById('draggable'); * const draggable = new Draggable(element, { * onDragStart: (e) => console.log('开始拖拽'), * onDrag: (e) => console.log('拖拽中'), * onDragEnd: (e) => console.log('结束拖拽'), * coordinate: 'tl' // 可选: tl(左上), tr(右上), bl(左下), br(右下) * }); */ interface DraggableOptions { onDragStart?: (event: MouseEvent) => void; onDrag?: (event: MouseEvent) => void; onDragEnd?: (event: MouseEvent) => void; position?: "absolute" | "fixed"; coordinate?: "tl" | "tr" | "bl" | "br"; } /** * 拖拽组件配置选项接口 * @interface DraggableOptions * @property {function} [onDragStart] - 开始拖拽时的回调函数 * @property {function} [onDrag] - 拖拽过程中的回调函数 * @property {function} [onDragEnd] - 结束拖拽时的回调函数 * @property {string} [position] - 定位方式,可选 absolute 或 fixed * @property {string} [coordinate] - 坐标原点,可选 tl(左上)、tr(右上)、bl(左下)、br(右下) */ export declare class Draggable { private element; private options; private isDragging; private startX; private startY; private initialX; private initialY; private threshold; private onMouseMoveHandler; private onMouseUpHandler; constructor(element: HTMLElement, options?: DraggableOptions); private onMouseDown; private getBoundedPosition; private onMouseMove; private convertCoordinate; private onMouseUp; } export {};