@zsviczian/excalidraw
Version:
Excalidraw as a React component
38 lines (37 loc) • 2.69 kB
TypeScript
import type { GlobalPoint, LineSegment } from "@excalidraw/math";
import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, Ordered } from "./types";
export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
export type HitTestArgs = {
point: GlobalPoint;
element: ExcalidrawElement;
threshold: number;
elementsMap: ElementsMap;
frameNameBound?: FrameNameBounds | null;
overrideShouldTestInside?: boolean;
};
export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, overrideShouldTestInside, }: HitTestArgs) => boolean;
export declare const hitElementBoundingBox: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
export declare const getAllHoveredElementAtPoint: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, tolerance?: number) => NonDeleted<ExcalidrawBindableElement>[];
export declare const getHoveredElementForBinding: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, tolerance?: number) => NonDeleted<ExcalidrawBindableElement> | null;
export declare const getHoveredElementForFocusPoint: (point: GlobalPoint, arrow: ExcalidrawArrowElement, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, tolerance?: number) => ExcalidrawBindableElement | null;
/**
* Intersect a line with an element for binding test
*
* @param element
* @param line
* @param offset
* @returns
*/
export declare const intersectElementWithLineSegment: (element: ExcalidrawElement, elementsMap: ElementsMap, line: LineSegment<GlobalPoint>, offset?: number, onlyFirst?: boolean) => GlobalPoint[];
/**
* Check if the given point is considered inside the element's border
*
* @param point
* @param element
* @returns
*/
export declare const isPointInElement: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
export declare const isBindableElementInsideOtherBindable: (innerElement: ExcalidrawBindableElement, outerElement: ExcalidrawBindableElement, elementsMap: ElementsMap) => boolean;