@vue-dnd-kit/core
Version:
Core functionality for Vue DnD Kit - a lightweight Vue 3 library for building performant and accessible drag and drop interfaces
44 lines (43 loc) • 1.6 kB
TypeScript
import { IConstraintsAreaEntity, TPointerState } from '../../external/types';
/**
* Finds constraint area for a draggable element
*/
export declare function findConstraintArea(draggable: HTMLElement, constraintsAreaMap: Map<HTMLElement, IConstraintsAreaEntity>): {
element: HTMLElement;
entity: IConstraintsAreaEntity;
} | null;
/**
* Applies axis constraint
*/
export declare function applyAxisConstraint(targetX: number, targetY: number, axis: 'x' | 'y' | 'both', draggableRect: DOMRect): {
x: number;
y: number;
};
/**
* Applies bounds constraint within container
*/
export declare function applyBoundsConstraint(targetX: number, targetY: number, axis: 'x' | 'y' | 'both', constraintRect: DOMRect, overlayRect: {
width: number;
height: number;
}): {
x: number;
y: number;
};
/**
* Calculates final overlay position with all constraints applied
*/
export declare function calculateConstrainedPosition(pointer: TPointerState, overlaySize: {
width: number;
height: number;
} | null, firstDraggable: HTMLElement | null, constraintsAreaMap: Map<HTMLElement, IConstraintsAreaEntity>): {
x: number;
y: number;
};
/**
* Updates pointer.current with constraint-applied coordinates.
* When constraints exist, stores the "effective" position so pointer matches overlay.
*/
export declare function updatePointerWithConstraints(pointer: TPointerState, rawX: number, rawY: number, overlaySize: {
width: number;
height: number;
} | null, firstDraggable: HTMLElement | null, constraintsAreaMap: Map<HTMLElement, IConstraintsAreaEntity>): void;