@myoc/excalidraw 0.18.17 → 0.18.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/{chunk-FQEIAL75.js → chunk-MAGRVBVM.js} +8745 -10813
- package/dist/dev/chunk-MAGRVBVM.js.map +7 -0
- package/dist/dev/{chunk-KJKC5BJI.js → chunk-QO4EFL6B.js} +6 -2
- package/dist/dev/chunk-QO4EFL6B.js.map +7 -0
- package/dist/dev/chunk-WUH7JFG4.js +7 -0
- package/dist/dev/chunk-WUH7JFG4.js.map +7 -0
- package/dist/dev/data/{image-WMF622SS.js → image-BBHDGXQ3.js} +3 -3
- package/dist/dev/index.css +32 -2
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +4749 -2336
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-UQFCZXHO.js → en-2WXBKZE2.js} +2 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-4Z2WWUCC.js +7 -0
- package/dist/prod/{chunk-EJLAYNAE.js → chunk-KZXLT4YB.js} +4 -4
- package/dist/prod/chunk-YBT3HBS6.js +33 -0
- package/dist/prod/data/image-JFILZTP3.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +18 -18
- package/dist/prod/locales/{en-7EHYHCIL.js → en-XFR6MADM.js} +1 -1
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/constants.d.ts +16 -1
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +1 -3
- package/dist/types/element/src/binding.d.ts +6 -7
- package/dist/types/element/src/bounds.d.ts +10 -4
- package/dist/types/element/src/collision.d.ts +18 -12
- package/dist/types/element/src/cropElement.d.ts +1 -1
- package/dist/types/element/src/delta.d.ts +26 -6
- package/dist/types/element/src/distance.d.ts +2 -2
- package/dist/types/element/src/elbowArrow.d.ts +1 -1
- package/dist/types/element/src/fractionalIndex.d.ts +8 -2
- package/dist/types/element/src/heading.d.ts +2 -2
- package/dist/types/element/src/index.d.ts +1 -3
- package/dist/types/element/src/linearElementEditor.d.ts +11 -18
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +2 -1
- package/dist/types/element/src/resizeElements.d.ts +1 -0
- package/dist/types/element/src/resizeTest.d.ts +2 -2
- package/dist/types/element/src/{ShapeCache.d.ts → shape.d.ts} +20 -3
- package/dist/types/element/src/shapes.d.ts +9 -9
- package/dist/types/element/src/sizeHelpers.d.ts +2 -1
- package/dist/types/element/src/store.d.ts +11 -7
- package/dist/types/element/src/typeChecks.d.ts +15 -1
- package/dist/types/element/src/types.d.ts +8 -3
- package/dist/types/element/src/utils.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +60 -24
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +31 -12
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +16 -6
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +25 -20
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +45 -18
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +58 -12
- package/dist/types/excalidraw/actions/actionFrame.d.ts +20 -8
- package/dist/types/excalidraw/actions/actionGroup.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +498 -2
- package/dist/types/excalidraw/actions/actionLink.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionMenu.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionProperties.d.ts +84 -31
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/types.d.ts +2 -1
- package/dist/types/excalidraw/appState.d.ts +10 -1
- package/dist/types/excalidraw/components/App.d.ts +7 -14
- package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
- package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
- package/dist/types/excalidraw/components/icons.d.ts +2 -0
- package/dist/types/excalidraw/eraser/index.d.ts +0 -2
- package/dist/types/excalidraw/history.d.ts +21 -5
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
- package/dist/types/excalidraw/renderer/helpers.d.ts +4 -4
- package/dist/types/excalidraw/scene/Renderer.d.ts +0 -1
- package/dist/types/excalidraw/types.d.ts +10 -4
- package/dist/types/math/src/angle.d.ts +3 -1
- package/dist/types/math/src/constants.d.ts +3 -0
- package/dist/types/math/src/curve.d.ts +33 -1
- package/dist/types/math/src/ellipse.d.ts +3 -3
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/point.d.ts +3 -3
- package/dist/types/math/src/polygon.d.ts +2 -2
- package/dist/types/math/src/segment.d.ts +5 -5
- package/dist/types/math/src/utils.d.ts +2 -0
- package/dist/types/math/src/vector.d.ts +4 -2
- package/dist/types/utils/src/shape.d.ts +12 -12
- package/history.ts +108 -45
- package/package.json +1 -1
- package/dist/dev/chunk-FQEIAL75.js.map +0 -7
- package/dist/dev/chunk-KJKC5BJI.js.map +0 -7
- package/dist/dev/chunk-XL2I4W52.js +0 -7
- package/dist/dev/chunk-XL2I4W52.js.map +0 -7
- package/dist/prod/chunk-5JAQX5EH.js +0 -7
- package/dist/prod/chunk-LSNMPGNI.js +0 -33
- package/dist/prod/data/image-Z433FUMH.js +0 -1
- package/dist/types/element/src/Shape.d.ts +0 -17
- package/dist/types/utils/src/collision.d.ts +0 -8
- /package/dist/dev/data/{image-WMF622SS.js.map → image-BBHDGXQ3.js.map} +0 -0
- /package/dist/dev/locales/{en-UQFCZXHO.js.map → en-2WXBKZE2.js.map} +0 -0
|
@@ -14,7 +14,7 @@ export type ActionResult = {
|
|
|
14
14
|
type ActionFn = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
15
15
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
16
16
|
export type ActionFilterFn = (action: Action) => void;
|
|
17
|
-
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "arrangeElements" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "smartZoom" | "toggleLassoTool" | "toggleShapeSwitch";
|
|
17
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "arrangeElements" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "smartZoom" | "toggleLassoTool" | "toggleShapeSwitch" | "togglePolygon";
|
|
18
18
|
export type PanelComponentProps = {
|
|
19
19
|
elements: readonly ExcalidrawElement[];
|
|
20
20
|
appState: AppState;
|
|
@@ -22,6 +22,7 @@ export type PanelComponentProps = {
|
|
|
22
22
|
appProps: ExcalidrawProps;
|
|
23
23
|
data?: Record<string, any>;
|
|
24
24
|
app: AppClassProperties;
|
|
25
|
+
renderAction: (name: ActionName, data?: PanelComponentProps["data"]) => React.JSX.Element | null;
|
|
25
26
|
};
|
|
26
27
|
export interface Action {
|
|
27
28
|
name: ActionName;
|
|
@@ -41,7 +41,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
41
41
|
currentItemStartArrowhead?: import("@excalidraw/element/types").Arrowhead | null | undefined;
|
|
42
42
|
currentItemEndArrowhead?: import("@excalidraw/element/types").Arrowhead | null | undefined;
|
|
43
43
|
currentItemRoundness?: import("@excalidraw/element/types").StrokeRoundness | undefined;
|
|
44
|
-
currentItemArrowType?: "
|
|
44
|
+
currentItemArrowType?: "sharp" | "round" | "elbow" | undefined;
|
|
45
45
|
viewBackgroundColor?: string | undefined;
|
|
46
46
|
scrolledOutside?: boolean | undefined;
|
|
47
47
|
name?: string | null | undefined;
|
|
@@ -74,18 +74,27 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
74
74
|
currentChartType?: import("@excalidraw/element/types").ChartType | undefined;
|
|
75
75
|
selectedLinearElement?: import("@excalidraw/element").LinearElementEditor | null | undefined;
|
|
76
76
|
objectsSnapModeEnabled?: boolean | undefined;
|
|
77
|
+
lockedMultiSelections?: {
|
|
78
|
+
[groupId: string]: true;
|
|
79
|
+
} | undefined;
|
|
77
80
|
};
|
|
78
81
|
export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
79
82
|
viewBackgroundColor?: string | undefined;
|
|
80
83
|
gridSize?: number | undefined;
|
|
81
84
|
gridStep?: number | undefined;
|
|
82
85
|
gridModeEnabled?: boolean | undefined;
|
|
86
|
+
lockedMultiSelections?: {
|
|
87
|
+
[groupId: string]: true;
|
|
88
|
+
} | undefined;
|
|
83
89
|
};
|
|
84
90
|
export declare const clearAppStateForDatabase: (appState: Partial<AppState>) => {
|
|
85
91
|
viewBackgroundColor?: string | undefined;
|
|
86
92
|
gridSize?: number | undefined;
|
|
87
93
|
gridStep?: number | undefined;
|
|
88
94
|
gridModeEnabled?: boolean | undefined;
|
|
95
|
+
lockedMultiSelections?: {
|
|
96
|
+
[groupId: string]: true;
|
|
97
|
+
} | undefined;
|
|
89
98
|
};
|
|
90
99
|
export declare const isEraserActive: ({ activeTool, }: {
|
|
91
100
|
activeTool: AppState["activeTool"];
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
|
|
3
|
-
import { LinearElementEditor } from "@excalidraw/element";
|
|
4
|
-
import { FlowChartCreator } from "@excalidraw/element";
|
|
5
|
-
import { Scene } from "@excalidraw/element";
|
|
6
|
-
import { Store } from "@excalidraw/element";
|
|
7
|
-
import type { ElementUpdate } from "@excalidraw/element";
|
|
3
|
+
import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate } from "@excalidraw/element";
|
|
8
4
|
import type { ExcalidrawElement, NonDeleted, InitializedExcalidrawImageElement, ExcalidrawImageElement, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
|
|
9
5
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
10
6
|
import { ActionManager } from "../actions/manager";
|
|
@@ -421,12 +417,9 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
421
417
|
private onKeyDown;
|
|
422
418
|
private onKeyUp;
|
|
423
419
|
private isToolSupported;
|
|
424
|
-
setActiveTool: (tool: (
|
|
425
|
-
type:
|
|
420
|
+
setActiveTool: (tool: ({
|
|
421
|
+
type: ToolType;
|
|
426
422
|
} | {
|
|
427
|
-
type: Extract<ToolType, "image">;
|
|
428
|
-
insertOnCanvasDirectly?: boolean;
|
|
429
|
-
}) | {
|
|
430
423
|
type: "custom";
|
|
431
424
|
customType: string;
|
|
432
425
|
}) & {
|
|
@@ -452,7 +445,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
452
445
|
private getTextElementAtPosition;
|
|
453
446
|
private getElementAtPosition;
|
|
454
447
|
private getElementsAtPosition;
|
|
455
|
-
getElementHitThreshold(): number;
|
|
448
|
+
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
456
449
|
private hitElement;
|
|
457
450
|
private getTextBindableContainerAtPosition;
|
|
458
451
|
private startTextEditing;
|
|
@@ -518,10 +511,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
518
511
|
/**
|
|
519
512
|
* inserts image into elements array and rerenders
|
|
520
513
|
*/
|
|
521
|
-
insertImageElement: (imageElement: ExcalidrawImageElement, imageFile: File
|
|
522
|
-
private setImagePreviewCursor;
|
|
514
|
+
insertImageElement: (imageElement: ExcalidrawImageElement, imageFile: File) => Promise<NonDeleted<InitializedExcalidrawImageElement> | null | undefined>;
|
|
523
515
|
private onImageAction;
|
|
524
|
-
initializeImageDimensions: (imageElement: ExcalidrawImageElement
|
|
516
|
+
initializeImageDimensions: (imageElement: ExcalidrawImageElement) => void;
|
|
517
|
+
private getImageNaturalDimensions;
|
|
525
518
|
/** updates image cache, refreshing updated elements and/or setting status
|
|
526
519
|
to error for images that fail during <img> element creation */
|
|
527
520
|
private updateImageCache;
|
|
@@ -10,6 +10,7 @@ interface ButtonIconProps {
|
|
|
10
10
|
/** include standalone style (could interfere with parent styles) */
|
|
11
11
|
standalone?: boolean;
|
|
12
12
|
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
13
|
+
style?: React.CSSProperties;
|
|
13
14
|
}
|
|
14
15
|
export declare const ButtonIcon: import("react").ForwardRefExoticComponent<ButtonIconProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
15
16
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./UnlockPopup.scss";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
import type { AppState } from "../types";
|
|
4
|
+
declare const UnlockPopup: ({ app, activeLockedId, }: {
|
|
5
|
+
app: App;
|
|
6
|
+
activeLockedId: NonNullable<AppState["activeLockedId"]>;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export default UnlockPopup;
|
|
@@ -12,8 +12,10 @@ export declare const LibraryIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
12
12
|
export declare const PlusIcon: import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export declare const DotsIcon: import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export declare const PinIcon: import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const polygonIcon: import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export declare const UnlockedIcon: import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export declare const LockedIcon: import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const LockedIconFilled: import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export declare const WelcomeScreenMenuArrow: import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export declare const WelcomeScreenHelpArrow: import("react/jsx-runtime").JSX.Element;
|
|
19
21
|
export declare const WelcomeScreenTopToolbarArrow: import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,8 +4,6 @@ import type App from "../components/App";
|
|
|
4
4
|
export declare class EraserTrail extends AnimatedTrail {
|
|
5
5
|
private elementsToErase;
|
|
6
6
|
private groupsToErase;
|
|
7
|
-
private segmentsCache;
|
|
8
|
-
private geometricShapesCache;
|
|
9
7
|
constructor(animationFrameHandler: AnimationFrameHandler, app: App);
|
|
10
8
|
startPath(x: number, y: number): void;
|
|
11
9
|
addPointToPath(x: number, y: number, restore?: boolean): string[];
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import { Emitter } from "@excalidraw/common";
|
|
2
|
-
import { StoreDelta
|
|
2
|
+
import { StoreDelta } from "@excalidraw/element";
|
|
3
|
+
import type { StoreSnapshot, Store } from "@excalidraw/element";
|
|
3
4
|
import type { SceneElementsMap } from "@excalidraw/element/types";
|
|
4
5
|
import type { AppState } from "./types";
|
|
5
|
-
declare class
|
|
6
|
+
export declare class HistoryDelta extends StoreDelta {
|
|
7
|
+
/**
|
|
8
|
+
* Apply the delta to the passed elements and appState, does not modify the snapshot.
|
|
9
|
+
*/
|
|
10
|
+
applyTo(elements: SceneElementsMap, appState: AppState, snapshot: StoreSnapshot): [SceneElementsMap, AppState, boolean];
|
|
11
|
+
/**
|
|
12
|
+
* Overriding once to avoid type casting everywhere.
|
|
13
|
+
*/
|
|
14
|
+
static calculate(prevSnapshot: StoreSnapshot, nextSnapshot: StoreSnapshot): HistoryDelta;
|
|
15
|
+
/**
|
|
16
|
+
* Overriding once to avoid type casting everywhere.
|
|
17
|
+
*/
|
|
18
|
+
static inverse(delta: StoreDelta): HistoryDelta;
|
|
19
|
+
/**
|
|
20
|
+
* Overriding once to avoid type casting everywhere.
|
|
21
|
+
*/
|
|
22
|
+
static applyLatestChanges(delta: StoreDelta, prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): HistoryDelta;
|
|
6
23
|
}
|
|
7
24
|
export declare class HistoryChangedEvent {
|
|
8
25
|
readonly isUndoStackEmpty: boolean;
|
|
@@ -12,8 +29,8 @@ export declare class HistoryChangedEvent {
|
|
|
12
29
|
export declare class History {
|
|
13
30
|
private readonly store;
|
|
14
31
|
readonly onHistoryChangedEmitter: Emitter<[HistoryChangedEvent]>;
|
|
15
|
-
readonly undoStack:
|
|
16
|
-
readonly redoStack:
|
|
32
|
+
readonly undoStack: HistoryDelta[];
|
|
33
|
+
readonly redoStack: HistoryDelta[];
|
|
17
34
|
get isUndoStackEmpty(): boolean;
|
|
18
35
|
get isRedoStackEmpty(): boolean;
|
|
19
36
|
constructor(store: Store);
|
|
@@ -29,4 +46,3 @@ export declare class History {
|
|
|
29
46
|
private static pop;
|
|
30
47
|
private static push;
|
|
31
48
|
}
|
|
32
|
-
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
|
|
2
|
-
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
export declare const getLassoSelectedElementIds: (input: {
|
|
4
4
|
lassoPath: GlobalPoint[];
|
|
5
5
|
elements: readonly ExcalidrawElement[];
|
|
6
|
+
elementsMap: ElementsMap;
|
|
6
7
|
elementsSegments: ElementsSegmentsMap;
|
|
7
8
|
intersectedElements: Set<ExcalidrawElement["id"]>;
|
|
8
9
|
enclosedElements: Set<ExcalidrawElement["id"]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
|
|
2
2
|
import type { StaticCanvasRenderConfig } from "../scene/types";
|
|
3
3
|
import type { AppState, StaticCanvasAppState } from "../types";
|
|
4
|
-
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: boolean) => void;
|
|
4
|
+
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
|
|
5
5
|
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
6
6
|
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
7
7
|
canvas: HTMLCanvasElement;
|
|
@@ -12,7 +12,7 @@ export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normali
|
|
|
12
12
|
isExporting?: boolean | undefined;
|
|
13
13
|
viewBackgroundColor?: string | null | undefined;
|
|
14
14
|
}) => CanvasRenderingContext2D;
|
|
15
|
-
export declare const drawHighlightForRectWithRotation: (context: CanvasRenderingContext2D, element: ExcalidrawRectanguloidElement, padding: number) => void;
|
|
15
|
+
export declare const drawHighlightForRectWithRotation: (context: CanvasRenderingContext2D, element: ExcalidrawRectanguloidElement, elementsMap: ElementsMap, padding: number) => void;
|
|
16
16
|
export declare const strokeEllipseWithRotation: (context: CanvasRenderingContext2D, width: number, height: number, cx: number, cy: number, angle: number) => void;
|
|
17
17
|
export declare const strokeRectWithRotation: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, cx: number, cy: number, angle: number, fill?: boolean, radius?: number) => void;
|
|
18
|
-
export declare const drawHighlightForDiamondWithRotation: (context: CanvasRenderingContext2D, padding: number, element: ExcalidrawDiamondElement) => void;
|
|
18
|
+
export declare const drawHighlightForDiamondWithRotation: (context: CanvasRenderingContext2D, padding: number, element: ExcalidrawDiamondElement, elementsMap: ElementsMap) => void;
|
|
@@ -16,7 +16,6 @@ export declare class Renderer {
|
|
|
16
16
|
/** note: first render of newElement will always bust the cache
|
|
17
17
|
* (we'd have to prefilter elements outside of this function) */
|
|
18
18
|
newElementId: ExcalidrawElement["id"] | undefined;
|
|
19
|
-
pendingImageElementId: AppState["pendingImageElementId"];
|
|
20
19
|
sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
|
|
21
20
|
}) => {
|
|
22
21
|
elementsMap: Map<string, NonDeletedExcalidrawElement> & import("@excalidraw/common/utility-types").MakeBrand<"NonDeletedElementsMap"> & import("@excalidraw/common/utility-types").MakeBrand<"RenderableElementsMap">;
|
|
@@ -2,7 +2,7 @@ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorTup
|
|
|
2
2
|
import type { SuggestedBinding } from "@excalidraw/element";
|
|
3
3
|
import type { LinearElementEditor } from "@excalidraw/element";
|
|
4
4
|
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
|
-
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId,
|
|
5
|
+
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, ArrangeAlgorithms } from "@excalidraw/element/types";
|
|
6
6
|
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
|
|
7
7
|
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
|
|
8
8
|
import type { Action } from "./actions/types";
|
|
@@ -113,7 +113,6 @@ type _CommonCanvasAppState = {
|
|
|
113
113
|
offsetLeft: AppState["offsetLeft"];
|
|
114
114
|
offsetTop: AppState["offsetTop"];
|
|
115
115
|
theme: AppState["theme"];
|
|
116
|
-
pendingImageElementId: AppState["pendingImageElementId"];
|
|
117
116
|
};
|
|
118
117
|
export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
119
118
|
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
@@ -146,6 +145,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
146
145
|
isCropping: AppState["isCropping"];
|
|
147
146
|
croppingElementId: AppState["croppingElementId"];
|
|
148
147
|
searchMatches: AppState["searchMatches"];
|
|
148
|
+
activeLockedId: AppState["activeLockedId"];
|
|
149
149
|
}>;
|
|
150
150
|
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
|
|
151
151
|
export type ObservedStandaloneAppState = {
|
|
@@ -159,6 +159,8 @@ export type ObservedElementsAppState = {
|
|
|
159
159
|
editingLinearElementId: LinearElementEditor["elementId"] | null;
|
|
160
160
|
selectedLinearElementId: LinearElementEditor["elementId"] | null;
|
|
161
161
|
croppingElementId: AppState["croppingElementId"];
|
|
162
|
+
lockedMultiSelections: AppState["lockedMultiSelections"];
|
|
163
|
+
activeLockedId: AppState["activeLockedId"];
|
|
162
164
|
};
|
|
163
165
|
export interface AppState {
|
|
164
166
|
contextMenu: {
|
|
@@ -332,8 +334,6 @@ export interface AppState {
|
|
|
332
334
|
shown: true;
|
|
333
335
|
data: Spreadsheet;
|
|
334
336
|
};
|
|
335
|
-
/** imageElement waiting to be placed on canvas */
|
|
336
|
-
pendingImageElementId: ExcalidrawImageElement["id"] | null;
|
|
337
337
|
showHyperlinkPopup: false | "info" | "editor";
|
|
338
338
|
selectedLinearElement: LinearElementEditor | null;
|
|
339
339
|
snapLines: readonly SnapLine[];
|
|
@@ -354,6 +354,11 @@ export interface AppState {
|
|
|
354
354
|
focusedId: ExcalidrawElement["id"] | null;
|
|
355
355
|
matches: readonly SearchMatch[];
|
|
356
356
|
}> | null;
|
|
357
|
+
/** the locked element/group that's active and shows unlock popup */
|
|
358
|
+
activeLockedId: string | null;
|
|
359
|
+
lockedMultiSelections: {
|
|
360
|
+
[groupId: string]: true;
|
|
361
|
+
};
|
|
357
362
|
}
|
|
358
363
|
export type SearchMatch = {
|
|
359
364
|
id: string;
|
|
@@ -628,6 +633,7 @@ export interface ExcalidrawImperativeAPI {
|
|
|
628
633
|
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
629
634
|
resetScene: InstanceType<typeof App>["resetScene"];
|
|
630
635
|
getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
|
|
636
|
+
getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
|
|
631
637
|
history: {
|
|
632
638
|
clear: InstanceType<typeof App>["resetHistory"];
|
|
633
639
|
};
|
|
@@ -5,7 +5,7 @@ export declare const normalizeRadians: (angle: Radians) => Radians;
|
|
|
5
5
|
* (x, y) for the center point 0,0 where the first number returned is the radius,
|
|
6
6
|
* the second is the angle in radians.
|
|
7
7
|
*/
|
|
8
|
-
export declare const cartesian2Polar: <P extends
|
|
8
|
+
export declare const cartesian2Polar: <P extends LocalPoint | GlobalPoint>([x, y,]: P) => PolarCoords;
|
|
9
9
|
export declare function degreesToRadians(degrees: Degrees): Radians;
|
|
10
10
|
export declare function radiansToDegrees(degrees: Radians): Degrees;
|
|
11
11
|
/**
|
|
@@ -15,3 +15,5 @@ export declare function radiansToDegrees(degrees: Radians): Degrees;
|
|
|
15
15
|
* @returns TRUE if the provided angle is a right angle
|
|
16
16
|
*/
|
|
17
17
|
export declare function isRightAngleRads(rads: Radians): boolean;
|
|
18
|
+
export declare function radiansBetweenAngles(a: Radians, min: Radians, max: Radians): boolean;
|
|
19
|
+
export declare function radiansDifference(a: Radians, b: Radians): Radians;
|
|
@@ -8,7 +8,7 @@ import type { Curve, GlobalPoint, LineSegment, LocalPoint } from "./types";
|
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
export declare function curve<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, c: Point, d: Point): Curve<Point>;
|
|
11
|
-
export declare const bezierEquation: <Point extends
|
|
11
|
+
export declare const bezierEquation: <Point extends LocalPoint | GlobalPoint>(c: Curve<Point>, t: number) => Point;
|
|
12
12
|
/**
|
|
13
13
|
* Computes the intersection between a cubic spline and a line segment.
|
|
14
14
|
*/
|
|
@@ -40,3 +40,35 @@ export declare function curvePointDistance<Point extends GlobalPoint | LocalPoin
|
|
|
40
40
|
*/
|
|
41
41
|
export declare function isCurve<P extends GlobalPoint | LocalPoint>(v: unknown): v is Curve<P>;
|
|
42
42
|
export declare function curveTangent<Point extends GlobalPoint | LocalPoint>([p0, p1, p2, p3]: Curve<Point>, t: number): import("./types").Vector;
|
|
43
|
+
export declare function curveCatmullRomQuadraticApproxPoints(points: GlobalPoint[], tension?: number): [GlobalPoint, GlobalPoint][] | undefined;
|
|
44
|
+
export declare function curveCatmullRomCubicApproxPoints<Point extends GlobalPoint | LocalPoint>(points: Point[], tension?: number): Curve<Point>[] | undefined;
|
|
45
|
+
export declare function curveOffsetPoints([p0, p1, p2, p3]: Curve<GlobalPoint>, offset: number, steps?: number): GlobalPoint[];
|
|
46
|
+
export declare function offsetPointsForQuadraticBezier(p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, offsetDist: number, steps?: number): GlobalPoint[];
|
|
47
|
+
/**
|
|
48
|
+
* Implementation based on Legendre-Gauss quadrature for more accurate arc
|
|
49
|
+
* length calculation.
|
|
50
|
+
*
|
|
51
|
+
* Reference: https://pomax.github.io/bezierinfo/#arclength
|
|
52
|
+
*
|
|
53
|
+
* @param c The curve to calculate the length of
|
|
54
|
+
* @returns The approximated length of the curve
|
|
55
|
+
*/
|
|
56
|
+
export declare function curveLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>): number;
|
|
57
|
+
/**
|
|
58
|
+
* Calculates the curve length from t=0 to t=parameter using the same
|
|
59
|
+
* Legendre-Gauss quadrature method used in curveLength
|
|
60
|
+
*
|
|
61
|
+
* @param c The curve to calculate the partial length for
|
|
62
|
+
* @param t The parameter value (0 to 1) to calculate length up to
|
|
63
|
+
* @returns The length of the curve from beginning to parameter t
|
|
64
|
+
*/
|
|
65
|
+
export declare function curveLengthAtParameter<P extends GlobalPoint | LocalPoint>(c: Curve<P>, t: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* Calculates the point at a specific percentage of a curve's total length
|
|
68
|
+
* using binary search for improved efficiency and accuracy.
|
|
69
|
+
*
|
|
70
|
+
* @param c The curve to calculate point on
|
|
71
|
+
* @param percent A value between 0 and 1 representing the percentage of the curve's length
|
|
72
|
+
* @returns The point at the specified percentage of curve length
|
|
73
|
+
*/
|
|
74
|
+
export declare function curvePointAtLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>, percent: number): P;
|
|
@@ -16,7 +16,7 @@ export declare function ellipse<Point extends GlobalPoint | LocalPoint>(center:
|
|
|
16
16
|
* @param ellipse The ellipse to compare against
|
|
17
17
|
* @returns TRUE if the point is inside or on the outline of the ellipse
|
|
18
18
|
*/
|
|
19
|
-
export declare const ellipseIncludesPoint: <Point extends
|
|
19
|
+
export declare const ellipseIncludesPoint: <Point extends LocalPoint | GlobalPoint>(p: Point, ellipse: Ellipse<Point>) => boolean;
|
|
20
20
|
/**
|
|
21
21
|
* Tests whether a point lies on the outline of the ellipse within a given
|
|
22
22
|
* tolerance
|
|
@@ -26,7 +26,7 @@ export declare const ellipseIncludesPoint: <Point extends GlobalPoint | LocalPoi
|
|
|
26
26
|
* @param threshold The distance to consider a point close enough to be "on" the outline
|
|
27
27
|
* @returns TRUE if the point is on the ellise outline
|
|
28
28
|
*/
|
|
29
|
-
export declare const ellipseTouchesPoint: <Point extends
|
|
29
|
+
export declare const ellipseTouchesPoint: <Point extends LocalPoint | GlobalPoint>(point: Point, ellipse: Ellipse<Point>, threshold?: number) => boolean;
|
|
30
30
|
/**
|
|
31
31
|
* Determine the shortest euclidean distance from a point to the
|
|
32
32
|
* outline of the ellipse
|
|
@@ -35,7 +35,7 @@ export declare const ellipseTouchesPoint: <Point extends GlobalPoint | LocalPoin
|
|
|
35
35
|
* @param ellipse The ellipse to calculate the distance to
|
|
36
36
|
* @returns The eucledian distance
|
|
37
37
|
*/
|
|
38
|
-
export declare const ellipseDistanceFromPoint: <Point extends
|
|
38
|
+
export declare const ellipseDistanceFromPoint: <Point extends LocalPoint | GlobalPoint>(p: Point, ellipse: Ellipse<Point>) => number;
|
|
39
39
|
/**
|
|
40
40
|
* Calculate a maximum of two intercept points for a line going throug an
|
|
41
41
|
* ellipse.
|
|
@@ -43,7 +43,7 @@ export declare function isPoint(p: unknown): p is LocalPoint | GlobalPoint;
|
|
|
43
43
|
* @param b Point The second point to compare
|
|
44
44
|
* @returns TRUE if the points are sufficiently close to each other
|
|
45
45
|
*/
|
|
46
|
-
export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point): boolean;
|
|
46
|
+
export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, tolerance?: number): boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Rotate a point by [angle] radians.
|
|
49
49
|
*
|
|
@@ -109,7 +109,7 @@ export declare function pointDistanceSq<P extends LocalPoint | GlobalPoint>(a: P
|
|
|
109
109
|
* @param multiplier The scaling factor
|
|
110
110
|
* @returns
|
|
111
111
|
*/
|
|
112
|
-
export declare const pointScaleFromOrigin: <P extends
|
|
112
|
+
export declare const pointScaleFromOrigin: <P extends LocalPoint | GlobalPoint>(p: P, mid: P, multiplier: number) => LocalPoint | GlobalPoint;
|
|
113
113
|
/**
|
|
114
114
|
* Returns whether `q` lies inside the segment/rectangle defined by `p` and `r`.
|
|
115
115
|
* This is an approximation to "does `q` lie on a segment `pr`" check.
|
|
@@ -119,4 +119,4 @@ export declare const pointScaleFromOrigin: <P extends GlobalPoint | LocalPoint>(
|
|
|
119
119
|
* @param r The other point to compare against
|
|
120
120
|
* @returns TRUE if q is indeed between p and r
|
|
121
121
|
*/
|
|
122
|
-
export declare const isPointWithinBounds: <P extends
|
|
122
|
+
export declare const isPointWithinBounds: <P extends LocalPoint | GlobalPoint>(p: P, q: P, r: P) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GlobalPoint, LocalPoint, Polygon } from "./types";
|
|
2
2
|
export declare function polygon<Point extends GlobalPoint | LocalPoint>(...points: Point[]): Polygon<Point>;
|
|
3
3
|
export declare function polygonFromPoints<Point extends GlobalPoint | LocalPoint>(points: Point[]): Polygon<Point>;
|
|
4
|
-
export declare const polygonIncludesPoint: <Point extends
|
|
4
|
+
export declare const polygonIncludesPoint: <Point extends LocalPoint | GlobalPoint>(point: Point, polygon: Polygon<Point>) => boolean;
|
|
5
5
|
export declare const polygonIncludesPointNonZero: <Point extends [number, number]>(point: Point, polygon: Point[]) => boolean;
|
|
6
|
-
export declare const pointOnPolygon: <Point extends
|
|
6
|
+
export declare const pointOnPolygon: <Point extends LocalPoint | GlobalPoint>(p: Point, poly: Polygon<Point>, threshold?: number) => boolean;
|
|
@@ -11,7 +11,7 @@ export declare function lineSegment<P extends GlobalPoint | LocalPoint>(a: P, b:
|
|
|
11
11
|
* @param segment
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
export declare const isLineSegment: <Point extends
|
|
14
|
+
export declare const isLineSegment: <Point extends LocalPoint | GlobalPoint>(segment: unknown) => segment is LineSegment<Point>;
|
|
15
15
|
/**
|
|
16
16
|
* Return the coordinates resulting from rotating the given line about an origin by an angle in radians
|
|
17
17
|
* note that when the origin is not given, the midpoint of the given line is used as the origin.
|
|
@@ -21,14 +21,14 @@ export declare const isLineSegment: <Point extends GlobalPoint | LocalPoint>(seg
|
|
|
21
21
|
* @param origin
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
export declare const lineSegmentRotate: <Point extends
|
|
24
|
+
export declare const lineSegmentRotate: <Point extends LocalPoint | GlobalPoint>(l: LineSegment<Point>, angle: Radians, origin?: Point | undefined) => LineSegment<Point>;
|
|
25
25
|
/**
|
|
26
26
|
* Calculates the point two line segments with a definite start and end point
|
|
27
27
|
* intersect at.
|
|
28
28
|
*/
|
|
29
|
-
export declare const segmentsIntersectAt: <Point extends
|
|
30
|
-
export declare const pointOnLineSegment: <Point extends
|
|
31
|
-
export declare const distanceToLineSegment: <Point extends
|
|
29
|
+
export declare const segmentsIntersectAt: <Point extends LocalPoint | GlobalPoint>(a: Readonly<LineSegment<Point>>, b: Readonly<LineSegment<Point>>) => Point | null;
|
|
30
|
+
export declare const pointOnLineSegment: <Point extends LocalPoint | GlobalPoint>(point: Point, line: LineSegment<Point>, threshold?: number) => boolean;
|
|
31
|
+
export declare const distanceToLineSegment: <Point extends LocalPoint | GlobalPoint>(point: Point, line: LineSegment<Point>) => number;
|
|
32
32
|
/**
|
|
33
33
|
* Returns the intersection point of a segment and a line
|
|
34
34
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Bounds } from "@excalidraw/element";
|
|
1
2
|
export declare const PRECISION = 0.0001;
|
|
2
3
|
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
3
4
|
export declare const round: (value: number, precision: number, func?: "round" | "floor" | "ceil") => number;
|
|
@@ -5,3 +6,4 @@ export declare const roundToStep: (value: number, step: number, func?: "round" |
|
|
|
5
6
|
export declare const average: (a: number, b: number) => number;
|
|
6
7
|
export declare const isFiniteNumber: (value: any) => value is number;
|
|
7
8
|
export declare const isCloseTo: (a: number, b: number, precision?: number) => boolean;
|
|
9
|
+
export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
|
|
@@ -12,9 +12,11 @@ export declare function vector(x: number, y: number, originX?: number, originY?:
|
|
|
12
12
|
*
|
|
13
13
|
* @param p The point to turn into a vector
|
|
14
14
|
* @param origin The origin point in a given coordiante system
|
|
15
|
-
* @
|
|
15
|
+
* @param threshold The threshold to consider the vector as 'undefined'
|
|
16
|
+
* @param defaultValue The default value to return if the vector is 'undefined'
|
|
17
|
+
* @returns The created vector from the point and the origin or default
|
|
16
18
|
*/
|
|
17
|
-
export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point): Vector;
|
|
19
|
+
export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point, threshold?: number, defaultValue?: Vector): Vector;
|
|
18
20
|
/**
|
|
19
21
|
* Cross product is a binary operation on two vectors in 2D space.
|
|
20
22
|
* It results in a vector that is perpendicular to both vectors.
|
|
@@ -30,13 +30,13 @@ export type GeometricShape<Point extends GlobalPoint | LocalPoint> = {
|
|
|
30
30
|
data: Polycurve<Point>;
|
|
31
31
|
};
|
|
32
32
|
type RectangularElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawTextElement | ExcalidrawSelectionElement;
|
|
33
|
-
export declare const getPolygonShape: <Point extends
|
|
34
|
-
export declare const getSelectionBoxShape: <Point extends
|
|
35
|
-
export declare const getEllipseShape: <Point extends
|
|
33
|
+
export declare const getPolygonShape: <Point extends LocalPoint | GlobalPoint>(element: RectangularElement) => GeometricShape<Point>;
|
|
34
|
+
export declare const getSelectionBoxShape: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap, padding?: number) => GeometricShape<Point>;
|
|
35
|
+
export declare const getEllipseShape: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawEllipseElement) => GeometricShape<Point>;
|
|
36
36
|
export declare const getCurvePathOps: (shape: Drawable) => Op[];
|
|
37
|
-
export declare const getCurveShape: <Point extends
|
|
38
|
-
export declare const getFreedrawShape: <Point extends
|
|
39
|
-
export declare const getClosedCurveShape: <Point extends
|
|
37
|
+
export declare const getCurveShape: <Point extends LocalPoint | GlobalPoint>(roughShape: Drawable, startingPoint: Point | undefined, angleInRadian: Radians, center: Point) => GeometricShape<Point>;
|
|
38
|
+
export declare const getFreedrawShape: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawFreeDrawElement, center: Point, isClosed?: boolean) => GeometricShape<Point>;
|
|
39
|
+
export declare const getClosedCurveShape: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawLinearElement, roughShape: Drawable, startingPoint: Point | undefined, angleInRadian: Radians, center: Point) => GeometricShape<Point>;
|
|
40
40
|
/**
|
|
41
41
|
* Determine intersection of a rectangular shaped element and a
|
|
42
42
|
* line segment.
|
|
@@ -46,13 +46,13 @@ export declare const getClosedCurveShape: <Point extends GlobalPoint | LocalPoin
|
|
|
46
46
|
* @param gap Optional value to inflate the shape before testing
|
|
47
47
|
* @returns An array of intersections
|
|
48
48
|
*/
|
|
49
|
-
export declare const segmentIntersectRectangleElement: <Point extends
|
|
50
|
-
export declare const pointOnEllipse: <Point extends
|
|
51
|
-
export declare const pointInEllipse: <Point extends
|
|
52
|
-
export declare const ellipseAxes: <Point extends
|
|
49
|
+
export declare const segmentIntersectRectangleElement: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawBindableElement, segment: LineSegment<Point>, gap?: number) => Point[];
|
|
50
|
+
export declare const pointOnEllipse: <Point extends LocalPoint | GlobalPoint>(point: Point, ellipse: Ellipse<Point>, threshold?: number) => boolean;
|
|
51
|
+
export declare const pointInEllipse: <Point extends LocalPoint | GlobalPoint>(p: Point, ellipse: Ellipse<Point>) => boolean;
|
|
52
|
+
export declare const ellipseAxes: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => {
|
|
53
53
|
majorAxis: number;
|
|
54
54
|
minorAxis: number;
|
|
55
55
|
};
|
|
56
|
-
export declare const ellipseFocusToCenter: <Point extends
|
|
57
|
-
export declare const ellipseExtremes: <Point extends
|
|
56
|
+
export declare const ellipseFocusToCenter: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => number;
|
|
57
|
+
export declare const ellipseExtremes: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => import("@excalidraw/math").Vector[];
|
|
58
58
|
export {};
|