UNPKG

@excalidraw/math

Version:

Excalidraw math functions

399 lines (398 loc) 17.4 kB
/// <reference types="react" /> import { LinearElementEditor } from "@excalidraw/element"; import type { LocalPoint } from "@excalidraw/math"; import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "@excalidraw/element/types"; import type { AppState } from "../types"; export declare const actionFinalize: { name: "finalize"; label: string; trackEvent: false; perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, data: any, app: import("../types").AppClassProperties) => { elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[]; appState: { selectedLinearElement: { selectedPointsIndices: null; elementId: string & { _brand: "excalidrawLinearElementId"; }; pointerDownState: Readonly<{ prevSelectedPointsIndices: readonly number[] | null; lastClickedPoint: number; lastClickedIsEndPoint: boolean; origin: Readonly<{ x: number; y: number; }> | null; segmentMidpoint: { value: import("@excalidraw/math").GlobalPoint | null; index: number | null; added: boolean; }; }>; isDragging: boolean; lastUncommittedPoint: LocalPoint | null; pointerOffset: Readonly<{ x: number; y: number; }>; startBindingElement: import("@excalidraw/element/types").ExcalidrawBindableElement | "keep" | null; endBindingElement: import("@excalidraw/element/types").ExcalidrawBindableElement | "keep" | null; hoverPointIndex: number; segmentMidPointHoveredCoords: import("@excalidraw/math").GlobalPoint | null; elbowed: boolean; customLineAngle: number | null; }; suggestedBindings: never[]; }; captureUpdate: "IMMEDIATELY"; } | { elements: import("@excalidraw/element/types").OrderedExcalidrawElement[] | undefined; appState: { cursorButton: "up"; editingLinearElement: null; contextMenu: { items: import("../components/ContextMenu").ContextMenuItems; top: number; left: number; } | null; showWelcomeScreen: boolean; isLoading: boolean; errorMessage: import("react").ReactNode; activeEmbeddable: { element: import("@excalidraw/element/types").NonDeletedExcalidrawElement; state: "active" | "hover"; } | null; newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null; resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null; multiElement: NonDeleted<ExcalidrawLinearElement> | null; selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null; isBindingEnabled: boolean; startBoundElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null; suggestedBindings: import("@excalidraw/element").SuggestedBinding[]; frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null; frameRendering: { enabled: boolean; name: boolean; outline: boolean; clip: boolean; }; editingFrame: string | null; elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null; editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null; activeTool: { lastActiveTool: import("../types").ActiveTool | null; locked: boolean; fromSelection: boolean; } & import("../types").ActiveTool; penMode: boolean; penDetected: boolean; exportBackground: boolean; exportEmbedScene: boolean; exportWithDarkMode: boolean; exportScale: number; currentItemStrokeColor: string; currentItemBackgroundColor: string; currentItemFillStyle: import("@excalidraw/element/types").FillStyle; currentItemStrokeWidth: number; currentItemStrokeStyle: import("@excalidraw/element/types").StrokeStyle; currentItemRoughness: number; currentItemOpacity: number; currentItemFontFamily: number; currentItemFontSize: number; currentItemTextAlign: string; currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null; currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null; currentHoveredFontFamily: number | null; currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness; currentItemArrowType: "round" | "sharp" | "elbow"; viewBackgroundColor: string; scrollX: number; scrollY: number; scrolledOutside: boolean; name: string | null; isResizing: boolean; isRotating: boolean; zoom: Readonly<{ value: import("../types").NormalizedZoomValue; }>; openMenu: "canvas" | "shape" | null; openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null; openSidebar: { name: string; tab?: string | undefined; } | null; openDialog: { name: "imageExport" | "help" | "jsonExport"; } | { name: "ttd"; tab: "mermaid" | "text-to-diagram"; } | { name: "commandPalette"; } | { name: "elementLinkSelector"; sourceElementId: string; } | null; defaultSidebarDockedPreference: boolean; lastPointerDownWith: import("@excalidraw/element/types").PointerType; selectedElementIds: Readonly<{ [id: string]: true; }>; hoveredElementIds: Readonly<{ [id: string]: true; }>; previousSelectedElementIds: { [id: string]: true; }; selectedElementsAreBeingDragged: boolean; shouldCacheIgnoreZoom: boolean; toast: { message: string; closable?: boolean | undefined; duration?: number | undefined; } | null; zenModeEnabled: boolean; theme: import("@excalidraw/element/types").Theme; gridSize: number; gridStep: number; gridModeEnabled: boolean; viewModeEnabled: boolean; selectedGroupIds: { [groupId: string]: boolean; }; editingGroupId: string | null; width: number; height: number; offsetTop: number; offsetLeft: number; fileHandle: import("browser-fs-access").FileSystemHandle | null; collaborators: Map<import("../types").SocketId, Readonly<{ pointer?: import("../types").CollaboratorPointer | undefined; button?: "up" | "down" | undefined; selectedElementIds?: Readonly<{ [id: string]: true; }> | undefined; username?: string | null | undefined; userState?: import("@excalidraw/common").UserIdleState | undefined; color?: { background: string; stroke: string; } | undefined; avatarUrl?: string | undefined; id?: string | undefined; socketId?: import("../types").SocketId | undefined; isCurrentUser?: boolean | undefined; isInCall?: boolean | undefined; isSpeaking?: boolean | undefined; isMuted?: boolean | undefined; }>>; stats: { open: boolean; panels: number; }; currentChartType: import("@excalidraw/element/types").ChartType; pasteDialog: { shown: false; data: null; } | { shown: true; data: import("../charts").Spreadsheet; }; showHyperlinkPopup: false | "editor" | "info"; selectedLinearElement: LinearElementEditor | null; snapLines: readonly import("../snapping").SnapLine[]; originSnapOffset: { x: number; y: number; } | null; objectsSnapModeEnabled: boolean; userToFollow: import("../types").UserToFollow | null; followedBy: Set<import("../types").SocketId>; isCropping: boolean; croppingElementId: string | null; searchMatches: Readonly<{ focusedId: string | null; matches: readonly import("../types").SearchMatch[]; }> | null; activeLockedId: string | null; lockedMultiSelections: { [groupId: string]: true; }; }; captureUpdate: "IMMEDIATELY"; } | { elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[]; appState: { cursorButton: "up"; activeTool: { lastActiveTool: import("../types").ActiveTool | null; locked: boolean; fromSelection: boolean; } & import("../types").ActiveTool; activeEmbeddable: null; newElement: null; selectionElement: null; multiElement: null; editingTextElement: null; startBoundElement: null; suggestedBindings: never[]; selectedElementIds: Readonly<{ [id: string]: true; }>; selectedLinearElement: LinearElementEditor | null; contextMenu: { items: import("../components/ContextMenu").ContextMenuItems; top: number; left: number; } | null; showWelcomeScreen: boolean; isLoading: boolean; errorMessage: import("react").ReactNode; resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null; isBindingEnabled: boolean; frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null; frameRendering: { enabled: boolean; name: boolean; outline: boolean; clip: boolean; }; editingFrame: string | null; elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null; editingLinearElement: LinearElementEditor | null; penMode: boolean; penDetected: boolean; exportBackground: boolean; exportEmbedScene: boolean; exportWithDarkMode: boolean; exportScale: number; currentItemStrokeColor: string; currentItemBackgroundColor: string; currentItemFillStyle: import("@excalidraw/element/types").FillStyle; currentItemStrokeWidth: number; currentItemStrokeStyle: import("@excalidraw/element/types").StrokeStyle; currentItemRoughness: number; currentItemOpacity: number; currentItemFontFamily: number; currentItemFontSize: number; currentItemTextAlign: string; currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null; currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null; currentHoveredFontFamily: number | null; currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness; currentItemArrowType: "round" | "sharp" | "elbow"; viewBackgroundColor: string; scrollX: number; scrollY: number; scrolledOutside: boolean; name: string | null; isResizing: boolean; isRotating: boolean; zoom: Readonly<{ value: import("../types").NormalizedZoomValue; }>; openMenu: "canvas" | "shape" | null; openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null; openSidebar: { name: string; tab?: string | undefined; } | null; openDialog: { name: "imageExport" | "help" | "jsonExport"; } | { name: "ttd"; tab: "mermaid" | "text-to-diagram"; } | { name: "commandPalette"; } | { name: "elementLinkSelector"; sourceElementId: string; } | null; defaultSidebarDockedPreference: boolean; lastPointerDownWith: import("@excalidraw/element/types").PointerType; hoveredElementIds: Readonly<{ [id: string]: true; }>; previousSelectedElementIds: { [id: string]: true; }; selectedElementsAreBeingDragged: boolean; shouldCacheIgnoreZoom: boolean; toast: { message: string; closable?: boolean | undefined; duration?: number | undefined; } | null; zenModeEnabled: boolean; theme: import("@excalidraw/element/types").Theme; gridSize: number; gridStep: number; gridModeEnabled: boolean; viewModeEnabled: boolean; selectedGroupIds: { [groupId: string]: boolean; }; editingGroupId: string | null; width: number; height: number; offsetTop: number; offsetLeft: number; fileHandle: import("browser-fs-access").FileSystemHandle | null; collaborators: Map<import("../types").SocketId, Readonly<{ pointer?: import("../types").CollaboratorPointer | undefined; button?: "up" | "down" | undefined; selectedElementIds?: Readonly<{ [id: string]: true; }> | undefined; username?: string | null | undefined; userState?: import("@excalidraw/common").UserIdleState | undefined; color?: { background: string; stroke: string; } | undefined; avatarUrl?: string | undefined; id?: string | undefined; socketId?: import("../types").SocketId | undefined; isCurrentUser?: boolean | undefined; isInCall?: boolean | undefined; isSpeaking?: boolean | undefined; isMuted?: boolean | undefined; }>>; stats: { open: boolean; panels: number; }; currentChartType: import("@excalidraw/element/types").ChartType; pasteDialog: { shown: false; data: null; } | { shown: true; data: import("../charts").Spreadsheet; }; showHyperlinkPopup: false | "editor" | "info"; snapLines: readonly import("../snapping").SnapLine[]; originSnapOffset: { x: number; y: number; } | null; objectsSnapModeEnabled: boolean; userToFollow: import("../types").UserToFollow | null; followedBy: Set<import("../types").SocketId>; isCropping: boolean; croppingElementId: string | null; searchMatches: Readonly<{ focusedId: string | null; matches: readonly import("../types").SearchMatch[]; }> | null; activeLockedId: string | null; lockedMultiSelections: { [groupId: string]: true; }; }; captureUpdate: "IMMEDIATELY"; }; keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState) => boolean; PanelComponent: ({ appState, updateData, data }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element; } & { keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: AppState) => boolean) | undefined; };