import { Event, EventEmitter, EventMap, InitModelOf, Insets, Point, Rectangle, Session, ViewportScroller, ViewportScrollerModel, Widget } from '../index'; export declare class MoveSupport extends EventEmitter { self: MoveSupport; eventMap: MoveSupportEventMap; /** * Minimal distance in pixels for a "mouse move" action to take effect. * Prevents "mini jumps" when simply clicking on an element. */ mouseMoveThreshold: number; /** * The maximum size the clone should have. If it exceeds that size it will be scaled down. */ maxCloneSize: number; /** * Widget containing the draggable elements */ widget: Widget; /** * Temporary data structure to hold data while a move operation is in progress. */ protected _moveData: MoveData; /** * For debugging, to slow down the animation */ protected _animationDurationFactor: number; protected _paused: boolean; protected _mouseMoveHandler: (event: JQuery.MouseMoveEvent) => void; protected _mouseUpHandler: (event: JQuery.MouseUpEvent) => void; protected _keyDownHandler: (event: KeyboardEvent) => void; protected _scrollHandler: (event: JQuery.ScrollEvent) => void; /** * @param widget the widget containing the draggable elements. Is used to automatically cancel the move operation when the widget is removed. */ constructor(widget: Widget); /** * @return `true` if the dragging was started successfully, false otherwise. */ start(event: JQuery.MouseDownEvent, elements: TElem[], draggedElement: TElem): boolean; protected _initMoveData(event: JQuery.MouseDownEvent, elements: TElem[], draggedElement: TElem): void; protected _initViewportScroller($viewport: JQuery, options?: ViewportScrollerModel): void; protected _viewportScrollerModel(): InitModelOf; protected _scrollViewport(dx: number, dy: number): void; protected _onScroll(event: JQuery.ScrollEvent): void; protected _createElementInfos(elements: TElem[], draggedElement: TElem): DraggableElementInfo[]; protected _updateElementInfo(elementInfo: DraggableElementInfo): void; protected _updateElementInfos(): void; cancel(): void; protected _restoreStyles(): void; protected _onMouseMove(event: JQuery.MouseMoveEvent): void; /** * Optional hook for subclasses, called just before {@link _startMove}. The default implementation does nothing. */ protected _onFirstMouseMove(): void; protected _startMove(event: JQuery.MouseEventBase): void; protected _whileMove(event: JQuery.MouseMoveEvent, distance: Point): void; protected _calculateScale(): number; /** * Adjusts relative values if the panel has been scrolled while dragging (e.g. using the mouse wheel) */ protected _updateOffsets(): void; protected _drag(event: JQuery.MouseMoveEvent): void; protected _dragOutside(event: JQuery.MouseMoveEvent): void; protected _append$Clone(): void; protected _update$Clone(scale: number): void; protected _onMouseUp(event: JQuery.MouseUpEvent): void; protected _onKeyDown(event: KeyboardEvent): void; protected _cleanup(): void; protected _moveToTarget(targetBounds: Rectangle): JQuery.Promise; /** * Called when the mouse button is released. * * After the promise is resolved, the clone is moved to the returned target bounds. The default * implementation returns the dragged element's original location. When the animation has been * completed, the clone is destroyed and the operation ends. * * @returns the target offset bounds to where the element should be moved, or null if the * operation should be ended without animation. */ protected _dragEnd(event: JQuery.MouseUpEvent): JQuery.Promise; /** * Called when the move operation has finished and the element was actually moved. * All animations are done, the clone and all listeners have been removed. */ protected _moveEnd(): void; /** * Called when the move operation has finished normally. The element may or may not have been * moved. All animations are done, the clone and all listeners have been removed. */ protected _end(): void; /** * Called when the move operation has been cancelled (e.g. user pressed ESC or widget was removed). */ protected _cancel(): void; } /** * Temporary data structure to store data while mouse actions are handled. */ export interface MoveData { session: Session; $window: JQuery; /** * The container containing the draggable elements */ $container: JQuery; /** * The offset bounds of the container relative to the document, including margins. */ containerBounds: Rectangle; /** * The element representing the scrollable viewport. Is either the same as $container or its scroll parent. * The viewport is scrolled automatically when the mouse cursor is moved near its edges while dragging. */ $viewport: JQuery; /** * The current scroll position of $viewport. */ scrollPosition: Point; /** * The maximum scroll position of $viewport. */ maxScrollPosition: Point; /** * Helper object to automatically scroll the $viewport when the mouse is moved towards its edges while dragging. */ viewportScroller: ViewportScroller; /** * The draggable elements. */ elements: TElem[]; /** * Contains various information about each element. */ elementInfos: DraggableElementInfo[]; /** * The dragged element. Same as to `draggedElementInfo.element`. */ draggedElement: TElem; /** * The dragged DOM element. Same as `draggedElementInfo.$element`. */ $draggedElement: JQuery; /** * Contains various information about the dragged element. */ draggedElementInfo: DraggableElementInfo; /** * Distance from cursor to the edges of the dragged element when the dragging started. */ cursorDistance: Insets; /** * The position of the cursor relative to the container when the dragging started. */ startCursorPosition: Point; /** * The current position of the cursor relative to the container. */ currentCursorPosition: Point; /** * Whether the dragged element is being moved. */ moving: boolean; /** * A clone of the dragged element that follows the cursor. The dragged element itself stays * at its original position until it should be moved to a new location. This element is only * created once the dragging has started (i.e. mouseMoveThreshold has been exceeded). */ $clone: JQuery; /** * A dedicated shadow element (inside the $clone) so it can be animated. */ $cloneShadow: JQuery; cloneStartOffset: Point; cloneBounds: Rectangle; } export interface DraggableElement { $container: JQuery; /** * Used to populate {@link MoveData.session}. */ session: Session; } export interface DraggableElementInfo { element: TElem; /** * Same as `element.$container` */ $element: JQuery; /** * The relative position to the container. */ position: Point; /** * The size and absolute position (relative to the window). */ bounds: Rectangle; } export interface MoveSupportEventMap extends EventMap { 'drag': Event; 'dragOutside': Event; 'moveEnd': Event; 'end': Event; 'cancel': Event; } //# sourceMappingURL=MoveSupport.d.ts.map