@excalidraw/math 0.18.0-a9ca16e → 0.18.0-abeeaeb
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/index.js +297 -99
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +1 -1
- package/dist/types/common/src/colors.d.ts +15 -1
- package/dist/types/common/src/constants.d.ts +12 -7
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +1 -43
- package/dist/types/element/src/Scene.d.ts +6 -4
- package/dist/types/element/src/align.d.ts +2 -2
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrows/focus.d.ts +5 -2
- package/dist/types/element/src/binding.d.ts +17 -8
- package/dist/types/element/src/bounds.d.ts +22 -7
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +1 -1
- package/dist/types/element/src/comparisons.d.ts +5 -4
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/distribute.d.ts +2 -2
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +4 -3
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +7 -7
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +9 -8
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/index.d.ts +4 -1
- package/dist/types/element/src/linearElementEditor.d.ts +17 -10
- package/dist/types/element/src/newElement.d.ts +14 -0
- package/dist/types/element/src/renderElement.d.ts +0 -3
- package/dist/types/element/src/resizeElements.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +6 -6
- package/dist/types/element/src/shape.d.ts +13 -1
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/textElement.d.ts +12 -9
- package/dist/types/element/src/transform.d.ts +2 -2
- package/dist/types/element/src/typeChecks.d.ts +26 -25
- package/dist/types/element/src/types.d.ts +8 -1
- package/dist/types/element/src/utils.d.ts +1 -1
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +45 -18
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +30 -12
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +167 -940
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +30 -12
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +47 -19
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionDeselect.d.ts} +29 -35
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +31 -13
- package/dist/types/excalidraw/actions/actionExport.d.ts +32 -14
- package/dist/types/excalidraw/actions/actionFrame.d.ts +57 -202
- package/dist/types/excalidraw/actions/actionGroup.d.ts +45 -27
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +19 -8
- package/dist/types/excalidraw/actions/actionLink.d.ts +16 -7
- package/dist/types/excalidraw/actions/actionMenu.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionProperties.d.ts +60 -30
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +20 -11
- package/dist/types/excalidraw/actions/actionStyles.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +16 -7
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +19 -11
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +16 -7
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +16 -7
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +19 -11
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +16 -7
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +17 -8
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +16 -7
- package/dist/types/excalidraw/actions/index.d.ts +2 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +8 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +12 -5
- package/dist/types/excalidraw/components/Actions.d.ts +17 -12
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +72 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +30 -0
- package/dist/types/excalidraw/components/App.d.ts +363 -66
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +31 -0
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +146 -0
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +6 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +8 -4
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +34 -16
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +23 -14
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +5 -1
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -3
- package/dist/types/excalidraw/scene/Renderer.d.ts +426 -19
- package/dist/types/excalidraw/scene/export.d.ts +3 -3
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +4 -3
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +415 -23
- package/dist/types/excalidraw/viewport.d.ts +275 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +36 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +4 -1
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/point.d.ts +1 -0
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +3 -3
- package/dist/types/utils/src/index.d.ts +1 -2
- package/package.json +2 -2
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/shapes.d.ts +0 -263
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
|
-
import { LinearElementEditor,
|
|
4
|
-
import type {
|
|
3
|
+
import { LinearElementEditor, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
|
|
4
|
+
import type { LocalPoint, Radians } from "@excalidraw/math";
|
|
5
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawTextContainer, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
5
6
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
6
7
|
import { ActionManager } from "../actions/manager";
|
|
7
|
-
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
8
8
|
import { History } from "../history";
|
|
9
9
|
import { Fonts } from "../fonts";
|
|
10
10
|
import { type WritableAtom } from "../editor-jotai";
|
|
11
11
|
import { Renderer } from "../scene/Renderer";
|
|
12
|
-
import {
|
|
12
|
+
import { type SetViewportOptions } from "../viewport";
|
|
13
|
+
import { LaserTrails } from "../laserTrails";
|
|
13
14
|
import { isOverScrollBars } from "../scene/scrollbars";
|
|
14
15
|
import { LassoTrail } from "../lasso";
|
|
15
16
|
import { EraserTrail } from "../eraser";
|
|
17
|
+
import { AppArrowText } from "./App.arrowText";
|
|
18
|
+
import { AppBucketFill } from "./App.bucketFill";
|
|
19
|
+
import { AppCursor } from "./App.cursor";
|
|
20
|
+
import { AppDrawShape } from "./App.drawshape";
|
|
21
|
+
import { AppFlowchart } from "./App.flowchart";
|
|
22
|
+
import { AppViewport } from "./App.viewport";
|
|
23
|
+
import { CursorHints } from "./CursorHint";
|
|
16
24
|
import { type OnStateChange } from "./AppStateObserver";
|
|
17
25
|
import type { ExportedElements } from "../data";
|
|
18
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize,
|
|
26
|
+
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, UIConfig } from "../types";
|
|
19
27
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
20
28
|
import type { ActionResult } from "../actions/types";
|
|
21
29
|
declare const editorLifecycleEventBehavior: {
|
|
@@ -78,6 +86,9 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
78
86
|
fonts: Fonts;
|
|
79
87
|
renderer: Renderer;
|
|
80
88
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
89
|
+
/** whether the last render had any renderable elements (excludes e.g. the
|
|
90
|
+
* in-progress `newElement` and the edited text element) */
|
|
91
|
+
private hasRenderableElements;
|
|
81
92
|
private resizeObserver;
|
|
82
93
|
library: AppClassProperties["library"];
|
|
83
94
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
@@ -107,9 +118,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
107
118
|
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
|
|
108
119
|
private appStateObserver;
|
|
109
120
|
onStateChange: OnStateChange;
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
bucketFill: AppBucketFill;
|
|
122
|
+
flowchart: AppFlowchart;
|
|
123
|
+
cursor: AppCursor;
|
|
124
|
+
arrowText: AppArrowText;
|
|
125
|
+
viewport: AppViewport;
|
|
112
126
|
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
127
|
+
private textWysiwygSubmitHandler;
|
|
113
128
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
114
129
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
115
130
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
@@ -126,14 +141,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
126
141
|
x: number;
|
|
127
142
|
y: number;
|
|
128
143
|
} | null;
|
|
129
|
-
|
|
130
|
-
x: number;
|
|
131
|
-
y: number;
|
|
132
|
-
};
|
|
133
|
-
animationFrameHandler: AnimationFrameHandler;
|
|
144
|
+
drawShape: AppDrawShape;
|
|
134
145
|
laserTrails: LaserTrails;
|
|
135
146
|
eraserTrail: EraserTrail;
|
|
136
147
|
lassoTrail: LassoTrail;
|
|
148
|
+
cursorHints: CursorHints;
|
|
137
149
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
138
150
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
139
151
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -268,6 +280,75 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
268
280
|
api: ExcalidrawImperativeAPI;
|
|
269
281
|
private createExcalidrawAPI;
|
|
270
282
|
constructor(props: AppProps);
|
|
283
|
+
/**
|
|
284
|
+
* Whether the editor accepts user input (pointer, keyboard, wheel, touch,
|
|
285
|
+
* clipboard, drag&drop). When `false`, the editor is fully inert for the
|
|
286
|
+
* user, but remains controllable through the imperative API.
|
|
287
|
+
*
|
|
288
|
+
* All user-input entry points must consult this getter (directly or by
|
|
289
|
+
* not being attached/rendered at all).
|
|
290
|
+
*/
|
|
291
|
+
isInteractionEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Whether element links render their link icon and are clickable.
|
|
294
|
+
* True when fully interactive, or when `interaction: { enabled: { links:
|
|
295
|
+
* true } }`
|
|
296
|
+
* (in which case clicking anywhere on a linked element opens the link,
|
|
297
|
+
* same as in view mode).
|
|
298
|
+
*/
|
|
299
|
+
isLinksEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Whether canvas navigation — panning & zooming, view-mode style — is
|
|
302
|
+
* enabled. True when fully interactive, or when `interaction: { enabled:
|
|
303
|
+
* { navigation: true } }`. Respects `appState.scrollConstraints`.
|
|
304
|
+
*/
|
|
305
|
+
isNavigationEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Whether embeddable & iframe elements are interactive (hover & click to
|
|
308
|
+
* activate, view-mode style). True when fully interactive, or when
|
|
309
|
+
* allowed via `interaction.enabled.embeds` / `.interactiveContent`.
|
|
310
|
+
*/
|
|
311
|
+
isEmbedsEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Whether the browser's own zoom (ctrl/cmd + wheel, pinch, keyboard
|
|
314
|
+
* shortcuts) stays available over the non-interactive editor.
|
|
315
|
+
* Prevented by default.
|
|
316
|
+
*/
|
|
317
|
+
isBrowserZoomEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Whether the tool can be activated & driven by user input. False when
|
|
320
|
+
* disabled via `UIOptions.tools`, or when the editor is non-interactive
|
|
321
|
+
* and the tool isn't kept user-driven via `interaction.enabled.tools`.
|
|
322
|
+
*
|
|
323
|
+
* (Once UI tool availability is split from input availability — e.g.
|
|
324
|
+
* `props.ui.tools` vs `interaction.disabled.tools` — the UI axis moves
|
|
325
|
+
* out into its own predicate.)
|
|
326
|
+
*
|
|
327
|
+
* We purposely widen the `tool` type so this helper can be called with
|
|
328
|
+
* any tool without having to type check it.
|
|
329
|
+
*/
|
|
330
|
+
isToolSupported: <T extends ToolType | "custom">(tool: T, props?: Pick<AppProps, "interaction" | "UIOptions">) => boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Whether the active tool is locked in place — via the tool lock
|
|
333
|
+
* (padlock / Q) or by being host-forced (`props.activeTool`). A locked
|
|
334
|
+
* tool doesn't revert to the selection tool after use, and elements drawn
|
|
335
|
+
* with it aren't selected. Forcing deliberately does not mutate
|
|
336
|
+
* `activeTool.locked`, which is the user's persisted padlock preference.
|
|
337
|
+
*/
|
|
338
|
+
isToolLocked(): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Whether the active tool captures the primary pointer instead of the
|
|
341
|
+
* view-mode drag-to-pan — the laser and host-implemented custom tools do;
|
|
342
|
+
* while non-interactive, any tool allowed via
|
|
343
|
+
* `interaction.enabled.tools` does. (Editing tools capture the pointer
|
|
344
|
+
* trivially since view mode implies they're not active; this predicate only
|
|
345
|
+
* matters where view-mode gates apply.)
|
|
346
|
+
*/
|
|
347
|
+
isActiveToolPointerCapturing(): boolean;
|
|
348
|
+
/** Whether Excalidraw's full default UI is rendered. */
|
|
349
|
+
isDefaultUIEnabled(props?: Pick<AppProps, "ui">): boolean;
|
|
350
|
+
/** Whether an individual default UI control is rendered. */
|
|
351
|
+
isUIControlEnabled(control: keyof UIConfig["enabled"], props?: Pick<AppProps, "ui">): boolean;
|
|
271
352
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
272
353
|
private onWindowMessage;
|
|
273
354
|
private handleSkipBindMode;
|
|
@@ -302,7 +383,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
302
383
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
303
384
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
304
385
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
305
|
-
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
386
|
+
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
306
387
|
}) => Promise<void>;
|
|
307
388
|
private magicGenerations;
|
|
308
389
|
private updateMagicGeneration;
|
|
@@ -318,9 +399,34 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
318
399
|
private openEyeDropper;
|
|
319
400
|
dismissLinearEditor: () => void;
|
|
320
401
|
syncActionResult: (actionResult: ActionResult) => void;
|
|
402
|
+
scheduleCapture: () => void;
|
|
321
403
|
private onBlur;
|
|
322
404
|
private onUnload;
|
|
323
405
|
private disableEvent;
|
|
406
|
+
private preventBrowserZoomWheel;
|
|
407
|
+
private handleNavigationModeKeyDown;
|
|
408
|
+
/**
|
|
409
|
+
* PageUp/PageDown scroll the canvas by a page — vertically, or
|
|
410
|
+
* horizontally with shift. Respects `appState.scrollConstraints`
|
|
411
|
+
* (via `viewport.translate`).
|
|
412
|
+
*/
|
|
413
|
+
private maybeHandlePageScrollKeyDown;
|
|
414
|
+
private preventBrowserZoomKeyDown;
|
|
415
|
+
/** Ends active input sessions before switching to a view-mode/non-interactive
|
|
416
|
+
* mode. */
|
|
417
|
+
private terminateActiveInteraction;
|
|
418
|
+
private handleInteractionStateChange;
|
|
419
|
+
/** whether the two values reference the same tool (incl. custom subtype) */
|
|
420
|
+
private isSameForcedTool;
|
|
421
|
+
/**
|
|
422
|
+
* Keeps `state.activeTool` synced to the host-controlled
|
|
423
|
+
* `props.activeTool`. `setActiveTool` refuses non-matching activations
|
|
424
|
+
* while forced (user input, API); this backstop covers the writers that
|
|
425
|
+
* bypass the funnel (`actionFinalize`/`actionDeselect`, `restore()` on
|
|
426
|
+
* scene load, ...) and re-applies the tool once it becomes activatable
|
|
427
|
+
* (e.g. `interaction` config changes).
|
|
428
|
+
*/
|
|
429
|
+
private handleForcedToolChange;
|
|
324
430
|
private resetHistory;
|
|
325
431
|
private resetStore;
|
|
326
432
|
/**
|
|
@@ -360,7 +466,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
360
466
|
clientY: number;
|
|
361
467
|
} | "cursor" | "center";
|
|
362
468
|
retainSeed?: boolean;
|
|
363
|
-
|
|
469
|
+
fit?: SetViewportOptions["fit"];
|
|
470
|
+
preserveFrameChildrenOrder?: boolean;
|
|
364
471
|
}) => void;
|
|
365
472
|
private addElementsFromMixedContentPaste;
|
|
366
473
|
private addTextFromPaste;
|
|
@@ -369,47 +476,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
369
476
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
370
477
|
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
371
478
|
togglePenMode: (force: boolean | null) => void;
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
*
|
|
375
|
-
*/
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
*
|
|
379
|
-
|
|
380
|
-
*/
|
|
381
|
-
value: number) => void;
|
|
382
|
-
private cancelInProgressAnimation;
|
|
383
|
-
scrollToContent: (
|
|
384
|
-
/**
|
|
385
|
-
* target to scroll to
|
|
386
|
-
*
|
|
387
|
-
* - string - id of element or group, or url containing elementLink
|
|
388
|
-
* - ExcalidrawElement | ExcalidrawElement[] - element(s) objects
|
|
389
|
-
*/
|
|
390
|
-
target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
|
|
391
|
-
fitToContent?: boolean;
|
|
392
|
-
fitToViewport?: never;
|
|
393
|
-
viewportZoomFactor?: number;
|
|
394
|
-
animate?: boolean;
|
|
395
|
-
duration?: number;
|
|
396
|
-
} | {
|
|
397
|
-
fitToContent?: never;
|
|
398
|
-
fitToViewport?: boolean;
|
|
399
|
-
/** when fitToViewport=true, how much screen should the content cover,
|
|
400
|
-
* between 0.1 (10%) and 1 (100%)
|
|
401
|
-
*/
|
|
402
|
-
viewportZoomFactor?: number;
|
|
403
|
-
animate?: boolean;
|
|
404
|
-
duration?: number;
|
|
405
|
-
}) & {
|
|
406
|
-
minZoom?: number;
|
|
407
|
-
maxZoom?: number;
|
|
408
|
-
canvasOffsets?: Offsets;
|
|
409
|
-
}) => void;
|
|
410
|
-
private maybeUnfollowRemoteUser;
|
|
411
|
-
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
412
|
-
private translateCanvas;
|
|
479
|
+
revealIfHidden: (elements: NonDeletedExcalidrawElement[]) => void;
|
|
480
|
+
/** emits a follow/unfollow intent to the host (which owns the
|
|
481
|
+
* `userToFollow` state) via both the `onUserFollow` prop and the
|
|
482
|
+
* imperative API emitter */
|
|
483
|
+
emitUserFollowIntent: (payload: OnUserFollowedPayload) => void;
|
|
484
|
+
/** emits an UNFOLLOW intent if currently following someone — use on
|
|
485
|
+
* user-initiated viewport changes which should break follow mode */
|
|
486
|
+
requestUnfollow: () => void;
|
|
413
487
|
setToast: (toast: AppState["toast"]) => void;
|
|
414
488
|
restoreFileFromShare: () => Promise<void>;
|
|
415
489
|
/**
|
|
@@ -437,7 +511,9 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
437
511
|
}) => void;
|
|
438
512
|
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
439
513
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
440
|
-
|
|
514
|
+
triggerRender: (
|
|
515
|
+
/** force always re-renders canvas even if no change */
|
|
516
|
+
force?: boolean) => void;
|
|
441
517
|
/**
|
|
442
518
|
* @returns whether the menu was toggled on or off
|
|
443
519
|
*/
|
|
@@ -447,10 +523,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
447
523
|
force?: boolean;
|
|
448
524
|
}) => boolean;
|
|
449
525
|
private updateCurrentCursorPosition;
|
|
450
|
-
getEditorUIOffsets: () => Offsets;
|
|
451
526
|
private onKeyDown;
|
|
452
527
|
private onKeyUp;
|
|
453
|
-
private isToolSupported;
|
|
454
528
|
setActiveTool: (tool: ({
|
|
455
529
|
type: ToolType;
|
|
456
530
|
} | {
|
|
@@ -459,10 +533,18 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
459
533
|
}) & {
|
|
460
534
|
locked?: boolean;
|
|
461
535
|
fromSelection?: boolean;
|
|
462
|
-
},
|
|
536
|
+
}, opts?: {
|
|
537
|
+
keepSelection?: boolean;
|
|
538
|
+
/**
|
|
539
|
+
* When `true`, re-activating an already-active toggle tool (see
|
|
540
|
+
* `TOGGLE_TOOLS`) switches back to the previously active tool.
|
|
541
|
+
* Activation is idempotent by default; toggle tools always record the
|
|
542
|
+
* previously active tool regardless (so ESC and the next `toggle`
|
|
543
|
+
* activation can switch back to it).
|
|
544
|
+
*/
|
|
545
|
+
toggle?: boolean;
|
|
546
|
+
}) => void;
|
|
463
547
|
setOpenDialog: (dialogType: AppState["openDialog"]) => void;
|
|
464
|
-
private setCursor;
|
|
465
|
-
private resetCursor;
|
|
466
548
|
/**
|
|
467
549
|
* returns whether user is making a gesture with >= 2 fingers (points)
|
|
468
550
|
* on o touch screen (not on a trackpad). Currently only relates to Darwin
|
|
@@ -478,14 +560,177 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
478
560
|
private deselectElements;
|
|
479
561
|
private getSelectedTextElement;
|
|
480
562
|
private getSelectedTextEditingContainerAtPosition;
|
|
481
|
-
|
|
563
|
+
getTextElementAtPosition(x: number, y: number): NonDeleted<ExcalidrawTextElement> | null;
|
|
482
564
|
private isHittingTextAutoResizeHandle;
|
|
483
565
|
private handleTextAutoResizeHandlePointerDown;
|
|
484
|
-
|
|
566
|
+
getElementAtPosition(x: number, y: number, opts?: ({
|
|
567
|
+
includeBoundTextElement?: boolean;
|
|
568
|
+
includeLockedElements?: boolean;
|
|
569
|
+
} | {
|
|
570
|
+
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
571
|
+
}) & {
|
|
572
|
+
preferSelected?: boolean;
|
|
573
|
+
}): NonDeleted<ExcalidrawElement> | null;
|
|
485
574
|
private getElementsAtPosition;
|
|
486
575
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
487
576
|
private hitElement;
|
|
488
|
-
|
|
577
|
+
getTextBindableContainerAtPosition(x: number, y: number): (Readonly<{
|
|
578
|
+
id: string;
|
|
579
|
+
x: number;
|
|
580
|
+
y: number;
|
|
581
|
+
strokeColor: string;
|
|
582
|
+
backgroundColor: string;
|
|
583
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
584
|
+
strokeWidth: number;
|
|
585
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
586
|
+
roundness: null | {
|
|
587
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
588
|
+
value?: number;
|
|
589
|
+
};
|
|
590
|
+
roughness: number;
|
|
591
|
+
opacity: number;
|
|
592
|
+
width: number;
|
|
593
|
+
height: number;
|
|
594
|
+
angle: Radians;
|
|
595
|
+
seed: number;
|
|
596
|
+
version: number;
|
|
597
|
+
versionNonce: number;
|
|
598
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
599
|
+
isDeleted: boolean;
|
|
600
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
601
|
+
frameId: string | null;
|
|
602
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
603
|
+
updated: number;
|
|
604
|
+
link: string | null;
|
|
605
|
+
locked: boolean;
|
|
606
|
+
customData?: Record<string, any>;
|
|
607
|
+
}> & {
|
|
608
|
+
type: "rectangle";
|
|
609
|
+
} & {
|
|
610
|
+
isDeleted: false;
|
|
611
|
+
}) | (Readonly<{
|
|
612
|
+
id: string;
|
|
613
|
+
x: number;
|
|
614
|
+
y: number;
|
|
615
|
+
strokeColor: string;
|
|
616
|
+
backgroundColor: string;
|
|
617
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
618
|
+
strokeWidth: number;
|
|
619
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
620
|
+
roundness: null | {
|
|
621
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
622
|
+
value?: number;
|
|
623
|
+
};
|
|
624
|
+
roughness: number;
|
|
625
|
+
opacity: number;
|
|
626
|
+
width: number;
|
|
627
|
+
height: number;
|
|
628
|
+
angle: Radians;
|
|
629
|
+
seed: number;
|
|
630
|
+
version: number;
|
|
631
|
+
versionNonce: number;
|
|
632
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
633
|
+
isDeleted: boolean;
|
|
634
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
635
|
+
frameId: string | null;
|
|
636
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
637
|
+
updated: number;
|
|
638
|
+
link: string | null;
|
|
639
|
+
locked: boolean;
|
|
640
|
+
customData?: Record<string, any>;
|
|
641
|
+
}> & {
|
|
642
|
+
type: "diamond";
|
|
643
|
+
} & {
|
|
644
|
+
isDeleted: false;
|
|
645
|
+
}) | (Readonly<{
|
|
646
|
+
id: string;
|
|
647
|
+
x: number;
|
|
648
|
+
y: number;
|
|
649
|
+
strokeColor: string;
|
|
650
|
+
backgroundColor: string;
|
|
651
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
652
|
+
strokeWidth: number;
|
|
653
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
654
|
+
roundness: null | {
|
|
655
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
656
|
+
value?: number;
|
|
657
|
+
};
|
|
658
|
+
roughness: number;
|
|
659
|
+
opacity: number;
|
|
660
|
+
width: number;
|
|
661
|
+
height: number;
|
|
662
|
+
angle: Radians;
|
|
663
|
+
seed: number;
|
|
664
|
+
version: number;
|
|
665
|
+
versionNonce: number;
|
|
666
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
667
|
+
isDeleted: boolean;
|
|
668
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
669
|
+
frameId: string | null;
|
|
670
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
671
|
+
updated: number;
|
|
672
|
+
link: string | null;
|
|
673
|
+
locked: boolean;
|
|
674
|
+
customData?: Record<string, any>;
|
|
675
|
+
}> & {
|
|
676
|
+
type: "ellipse";
|
|
677
|
+
} & {
|
|
678
|
+
isDeleted: false;
|
|
679
|
+
}) | (Readonly<{
|
|
680
|
+
id: string;
|
|
681
|
+
x: number;
|
|
682
|
+
y: number;
|
|
683
|
+
strokeColor: string;
|
|
684
|
+
backgroundColor: string;
|
|
685
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
686
|
+
strokeWidth: number;
|
|
687
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
688
|
+
roundness: null | {
|
|
689
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
690
|
+
value?: number;
|
|
691
|
+
};
|
|
692
|
+
roughness: number;
|
|
693
|
+
opacity: number;
|
|
694
|
+
width: number;
|
|
695
|
+
height: number;
|
|
696
|
+
angle: Radians;
|
|
697
|
+
seed: number;
|
|
698
|
+
version: number;
|
|
699
|
+
versionNonce: number;
|
|
700
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
701
|
+
isDeleted: boolean;
|
|
702
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
703
|
+
frameId: string | null;
|
|
704
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
705
|
+
updated: number;
|
|
706
|
+
link: string | null;
|
|
707
|
+
locked: boolean;
|
|
708
|
+
customData?: Record<string, any>;
|
|
709
|
+
}> & Readonly<{
|
|
710
|
+
type: "line" | "arrow";
|
|
711
|
+
points: readonly LocalPoint[];
|
|
712
|
+
startBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
713
|
+
endBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
714
|
+
startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
715
|
+
endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
716
|
+
}> & Readonly<{
|
|
717
|
+
type: "arrow";
|
|
718
|
+
elbowed: boolean;
|
|
719
|
+
}> & {
|
|
720
|
+
isDeleted: false;
|
|
721
|
+
}) | null;
|
|
722
|
+
/**
|
|
723
|
+
* Whether a text element's content is still being authored.
|
|
724
|
+
*
|
|
725
|
+
* Creating a text reverts the tool to selection during pointerdown, so the
|
|
726
|
+
* pointerup that follows looks like an ordinary canvas click and would
|
|
727
|
+
* capture the still-empty element as a history entry of its own. Undo would
|
|
728
|
+
* then rewind only the typing, restoring an invisible, zero-content element
|
|
729
|
+
* (and, for an endpoint label, leaving the arrow bound to it) rather than
|
|
730
|
+
* removing it. The editor's own submit captures the finished text instead,
|
|
731
|
+
* so the whole create-and-type lands in a single entry.
|
|
732
|
+
*/
|
|
733
|
+
private isEditingTextContent;
|
|
489
734
|
private startTextEditing;
|
|
490
735
|
private startImageCropping;
|
|
491
736
|
private finishImageCropping;
|
|
@@ -494,7 +739,48 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
494
739
|
private handleCanvasClick;
|
|
495
740
|
private getElementLinkAtPosition;
|
|
496
741
|
private handleElementLinkClick;
|
|
497
|
-
|
|
742
|
+
/**
|
|
743
|
+
* Applies (or clears) the element-link hover affordances — pointer cursor
|
|
744
|
+
* and tooltip — based on the current `hitLinkElement`. Returns whether a
|
|
745
|
+
* link is being hovered.
|
|
746
|
+
*/
|
|
747
|
+
private applyElementLinkHoverAffordance;
|
|
748
|
+
/**
|
|
749
|
+
* On touchscreens (where no hover precedes the tap) re-derives
|
|
750
|
+
* `hitLinkElement`, then opens the hit element link, if any.
|
|
751
|
+
* Returns whether a link click was handled.
|
|
752
|
+
*/
|
|
753
|
+
private maybeHandleElementLinkClick;
|
|
754
|
+
/**
|
|
755
|
+
* Restricted pointer handling for the non-interactive editor with links
|
|
756
|
+
* and/or embeds allowed (`interaction.enabled.links` / `.embeds` /
|
|
757
|
+
* `.interactiveContent`) — runs only the element-link & embed concerns
|
|
758
|
+
* (shared with the full pointer handlers above) so they behave like in
|
|
759
|
+
* view mode without the rest of the canvas pointer machinery.
|
|
760
|
+
*/
|
|
761
|
+
private handleInteractiveContentPointerMove;
|
|
762
|
+
private handleInteractiveContentPointerUp;
|
|
763
|
+
/**
|
|
764
|
+
* finds candidate frame under cursor (when dragging frame children/elements
|
|
765
|
+
* inside frames)
|
|
766
|
+
*/
|
|
767
|
+
getTopLayerFrameAtSceneCoords: (
|
|
768
|
+
/**
|
|
769
|
+
* should be already grid aligned (basically should be what the call site
|
|
770
|
+
* sets the element's coords to, if applicable)
|
|
771
|
+
*/
|
|
772
|
+
sceneCoords: {
|
|
773
|
+
x: number;
|
|
774
|
+
y: number;
|
|
775
|
+
}, opts?: {
|
|
776
|
+
/** to exclude selected elements when dragging, etc. */
|
|
777
|
+
excludeElementIds?: AppState["selectedElementIds"];
|
|
778
|
+
currentFrameId?: ExcalidrawElement["frameId"];
|
|
779
|
+
}) => NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
780
|
+
private updateFrameToHighlight;
|
|
781
|
+
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
782
|
+
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
783
|
+
insertNewElement: (element: ExcalidrawElement) => void;
|
|
498
784
|
private handleCanvasPointerMove;
|
|
499
785
|
private handleEraser;
|
|
500
786
|
private handleTouchMove;
|
|
@@ -511,6 +797,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
511
797
|
private maybeCleanupAfterMissingPointerUp;
|
|
512
798
|
handleCanvasPanUsingWheelOrSpaceDrag: (event: React.PointerEvent<HTMLElement> | MouseEvent) => boolean;
|
|
513
799
|
private updateGestureOnPointerDown;
|
|
800
|
+
/**
|
|
801
|
+
* Tracks the pointer within the ongoing multi-touch gesture and applies
|
|
802
|
+
* the two-finger pinch zoom/pan, if any.
|
|
803
|
+
*/
|
|
804
|
+
private updateMultiTouchGesture;
|
|
514
805
|
private initialPointerDownState;
|
|
515
806
|
private handleDraggingScrollBar;
|
|
516
807
|
private clearSelectionIfNotUsingSelection;
|
|
@@ -536,6 +827,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
536
827
|
private newImagePlaceholder;
|
|
537
828
|
private handleLinearElementOnPointerDown;
|
|
538
829
|
private getCurrentItemRoundness;
|
|
830
|
+
private getCurrentItemStrokeWidth;
|
|
539
831
|
private createGenericElementOnPointerDown;
|
|
540
832
|
private createFrameElementOnPointerDown;
|
|
541
833
|
private maybeCacheReferenceSnapPoints;
|
|
@@ -575,7 +867,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
575
867
|
private maybeHandleResize;
|
|
576
868
|
private getContextMenuItems;
|
|
577
869
|
private handleWheel;
|
|
578
|
-
|
|
870
|
+
getTextWysiwygSnappedToCenterPosition(x: number, y: number, appState: AppState, container?: ExcalidrawTextContainer | null): {
|
|
871
|
+
viewportX: number;
|
|
872
|
+
viewportY: number;
|
|
873
|
+
elementCenterX: number;
|
|
874
|
+
elementCenterY: number;
|
|
875
|
+
} | undefined;
|
|
579
876
|
private savePointer;
|
|
580
877
|
private resetShouldCacheIgnoreZoomDebounced;
|
|
581
878
|
private updateDOMRect;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DrawShapeTrail } from "../drawShapeTrail";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
import type { PointerDownState } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Captures the App state management for the drawShape tool (free-form
|
|
6
|
+
* sketch converted into a recognized excalidraw element). Pointer events
|
|
7
|
+
* are piped here from App.
|
|
8
|
+
*
|
|
9
|
+
* The gesture is committed by `finalize()` — recognize → (maybe upgrade
|
|
10
|
+
* line to arrow) → insert → bind endpoints — which is invoked from within
|
|
11
|
+
* `actionFinalize`, the editor's single finalization funnel. Whatever
|
|
12
|
+
* triggers a finalize (the gesture's own pointerup, a mid-gesture paste
|
|
13
|
+
* switching tools, …), the pending sketch resolves there exactly once.
|
|
14
|
+
*/
|
|
15
|
+
export declare class AppDrawShape {
|
|
16
|
+
private app;
|
|
17
|
+
trail: DrawShapeTrail;
|
|
18
|
+
/** a pointerdown started a sketch that `finalize()` hasn't resolved yet */
|
|
19
|
+
private gestureInProgress;
|
|
20
|
+
constructor(app: App);
|
|
21
|
+
stop: () => void;
|
|
22
|
+
hasPendingGesture: () => boolean;
|
|
23
|
+
handlePointerDown: (pointerDownState: PointerDownState) => void;
|
|
24
|
+
/** returns true when the pointermove was consumed by the shape preview */
|
|
25
|
+
handlePointerMove: (pointerCoords: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Binds both endpoints of a freshly inserted drawShape arrow to the
|
|
31
|
+
* bindable elements they hover, if any.
|
|
32
|
+
*
|
|
33
|
+
* Endpoints bind in "orbit" mode — the arrow starts/ends at the target's
|
|
34
|
+
* outline — even when the stroke was started or released inside the shape
|
|
35
|
+
* (a sketched connector aims at the shape, not at a point inside it). The
|
|
36
|
+
* exception is a sketch contained in a single shape: both ends then bind
|
|
37
|
+
* "inside" and stay where they were drawn, like the interactive
|
|
38
|
+
* inside→inside flow.
|
|
39
|
+
*/
|
|
40
|
+
private bindRecognizedArrow;
|
|
41
|
+
/**
|
|
42
|
+
* A sketched line that connects a bindable element with something else —
|
|
43
|
+
* another element or blank canvas — was meant as a connector: upgrade it
|
|
44
|
+
* to an arrow (called before insertion). A line touching no shape, or
|
|
45
|
+
* contained in a single shape (an annotation, not a connector), stays a
|
|
46
|
+
* line.
|
|
47
|
+
*/
|
|
48
|
+
private maybeUpgradeLineToArrow;
|
|
49
|
+
/**
|
|
50
|
+
* Commits the pending sketch, if any, and clears the trail. Invoked from
|
|
51
|
+
* within `actionFinalize` — never call directly, execute `actionFinalize`
|
|
52
|
+
* instead so element insertion flows into the action's returned elements.
|
|
53
|
+
*/
|
|
54
|
+
finalize: () => void;
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
import type { PendingExcalidrawElements } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Captures the App state management for the flowchart functionality.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AppFlowchart {
|
|
8
|
+
private app;
|
|
9
|
+
private creator;
|
|
10
|
+
private navigator;
|
|
11
|
+
constructor(app: App);
|
|
12
|
+
get pendingNodes(): PendingExcalidrawElements | null;
|
|
13
|
+
get isCreatingChart(): boolean;
|
|
14
|
+
/** ends any in-progress flowchart creation/navigation session */
|
|
15
|
+
clear: () => void;
|
|
16
|
+
handleKeyEvent: (event: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
17
|
+
private resolveKeyboardEventToOperation;
|
|
18
|
+
private selectAndReveal;
|
|
19
|
+
private captureUpdate;
|
|
20
|
+
private static getLinkDirectionFromKey;
|
|
21
|
+
}
|