import { EventTarget } from '@mathigon/core'; import { Bounds, Point } from '@mathigon/euclid'; import { ElementView } from '../'; interface DraggableOptions { /** The container within which this element is being dragged. */ $parent?: ElementView; /** Whether to constrain the elements to within the bounds of $parent. */ withinBounds?: boolean; /** Whether it is draggable along the x-axis. */ moveX?: boolean; /** Whether it is draggable along the y-axis. */ moveY?: boolean; /** Interval for snapping (in px) */ snap?: number; /** Whether to use CSS transforms rather than `left` and `right`. */ useTransform?: boolean; /** Margin within the `$parent` element. */ margin?: number; /** Custom rounding function. */ round?: ((p: Point) => Point); /** Custom bounds within which the element is draggable. */ bounds?: Bounds; /** Whether to reset position when dropped outside of a target */ resetOnMiss?: boolean; /** Elements that the Draggable instance can be dropped onto */ $targets?: ElementView[]; } /** * A draggable and droppable HTML element. * @emits Draggable#click - Fired when the user clicks on this element. * @emits Draggable#start - Fired when the user starts dragging. * @emits Draggable#drag {posn: Point, pointerPosn: Point} - Fired while the user is dragging. * @emits Draggable#move {posn: Point} - Fired when the position of this element changes. * @emits Draggable#end {$target?: ElementView} - Fired after the user stops dragging this element, including the current `$target` which may be undefined. * @emits Draggable#enter-target {$target: ElementView} - Fired when the pointer enters the bounds of a `$target` element while dragging * @emits Draggable#exit-target {$target: ElementView} - Fired when the pointer exists the bounds of a `$target` element while dragging */ export declare class Draggable extends EventTarget { readonly $el: ElementView; protected options: DraggableOptions; private startPos; private $over?; position: Point; disabled: boolean; bounds?: Bounds; constructor($el: ElementView, options?: DraggableOptions); addTarget($target: ElementView): void; removeTarget($target: ElementView): void; private checkTarget; private updateBounds; /** Sets the position of the element. */ setPosition(x: number, y: number): void; resetPosition(duration?: number): Promise; } export {};