@excalidraw/excalidraw 0.17.1-7441-4e2c539 → 0.17.1-a38e82f
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/CHANGELOG.md +52 -2
- package/dist/browser/dev/excalidraw-assets-dev/chunk-5VWQDKDR.js +20279 -0
- package/dist/browser/dev/excalidraw-assets-dev/chunk-5VWQDKDR.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{chunk-2W5GQUR4.js → chunk-IM4WTX2M.js} +12 -6
- package/dist/browser/dev/excalidraw-assets-dev/chunk-IM4WTX2M.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{en-OC6JWP3X.js → en-IOBA4CS2.js} +4 -2
- package/dist/browser/dev/excalidraw-assets-dev/image-LK4UNFRZ.css +6 -0
- package/dist/browser/dev/excalidraw-assets-dev/image-LK4UNFRZ.css.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{image-HYNUJ3XL.js → image-VKDAL6BQ.js} +2 -4
- package/dist/browser/dev/excalidraw-assets-dev/roundRect-T5BX56ZF.js +161 -0
- package/dist/browser/dev/excalidraw-assets-dev/roundRect-T5BX56ZF.js.map +7 -0
- package/dist/browser/dev/index.css +189 -129
- package/dist/browser/dev/index.css.map +3 -3
- package/dist/browser/dev/index.js +34707 -26
- package/dist/browser/dev/index.js.map +4 -4
- package/dist/browser/prod/excalidraw-assets/chunk-LIG3S5TN.js +11 -0
- package/dist/browser/prod/excalidraw-assets/chunk-N2C5DK3B.js +55 -0
- package/dist/browser/prod/excalidraw-assets/en-WFZVQ7I6.js +1 -0
- package/dist/browser/prod/excalidraw-assets/image-4AT7LYMR.js +1 -0
- package/dist/browser/prod/excalidraw-assets/image-X66R2EM5.css +1 -0
- package/dist/browser/prod/excalidraw-assets/roundRect-2ACQK4DA.js +1 -0
- package/dist/browser/prod/index.css +1 -1
- package/dist/browser/prod/index.js +203 -1
- package/dist/{prod/en-RLIAOBCI.json → dev/en-TDNWCAOT.json} +9 -5
- package/dist/dev/index.css +189 -129
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +38445 -39402
- package/dist/dev/index.js.map +4 -4
- package/dist/excalidraw/actions/actionAddToLibrary.d.ts +12 -12
- package/dist/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/excalidraw/actions/actionAlign.js +2 -1
- package/dist/excalidraw/actions/actionBoundText.d.ts +8 -8
- package/dist/excalidraw/actions/actionBoundText.js +8 -8
- package/dist/excalidraw/actions/actionCanvas.d.ts +46 -46
- package/dist/excalidraw/actions/actionClipboard.d.ts +27 -27
- package/dist/excalidraw/actions/actionClipboard.js +9 -2
- package/dist/excalidraw/actions/actionDeleteSelected.d.ts +12 -12
- package/dist/excalidraw/actions/actionDeleteSelected.js +3 -2
- package/dist/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/excalidraw/actions/actionDistribute.js +1 -1
- package/dist/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
- package/dist/excalidraw/actions/actionDuplicateSelection.js +4 -3
- package/dist/excalidraw/actions/actionElementLock.d.ts +8 -8
- package/dist/excalidraw/actions/actionExport.d.ts +35 -35
- package/dist/excalidraw/actions/actionExport.js +4 -4
- package/dist/excalidraw/actions/actionFinalize.d.ts +7 -7
- package/dist/excalidraw/actions/actionFinalize.js +7 -6
- package/dist/excalidraw/actions/actionFlip.d.ts +2 -2
- package/dist/excalidraw/actions/actionFlip.js +11 -11
- package/dist/excalidraw/actions/actionFrame.d.ts +13 -13
- package/dist/excalidraw/actions/actionFrame.js +1 -1
- package/dist/excalidraw/actions/actionGroup.d.ts +8 -8
- package/dist/excalidraw/actions/actionGroup.js +3 -2
- package/dist/excalidraw/actions/actionLinearEditor.d.ts +4 -4
- package/dist/excalidraw/actions/actionLinearEditor.js +1 -1
- package/dist/excalidraw/{element/Hyperlink.d.ts → actions/actionLink.d.ts} +28 -50
- package/dist/excalidraw/actions/actionLink.js +40 -0
- package/dist/excalidraw/actions/actionMenu.d.ts +11 -11
- package/dist/excalidraw/actions/actionNavigate.d.ts +8 -8
- package/dist/excalidraw/actions/actionNavigate.js +1 -1
- package/dist/excalidraw/actions/actionProperties.d.ts +64 -64
- package/dist/excalidraw/actions/actionProperties.js +32 -27
- package/dist/excalidraw/actions/actionSelectAll.d.ts +4 -4
- package/dist/excalidraw/actions/actionSelectAll.js +1 -1
- package/dist/excalidraw/actions/actionStyles.d.ts +6 -6
- package/dist/excalidraw/actions/actionStyles.js +4 -4
- package/dist/excalidraw/actions/actionToggleGridMode.d.ts +4 -4
- package/dist/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
- package/dist/excalidraw/actions/actionToggleStats.d.ts +4 -4
- package/dist/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
- package/dist/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
- package/dist/excalidraw/actions/index.d.ts +1 -1
- package/dist/excalidraw/actions/index.js +1 -1
- package/dist/excalidraw/actions/manager.js +2 -1
- package/dist/excalidraw/align.d.ts +2 -2
- package/dist/excalidraw/align.js +2 -2
- package/dist/excalidraw/animated-trail.d.ts +33 -0
- package/dist/excalidraw/animated-trail.js +96 -0
- package/dist/excalidraw/animation-frame-handler.d.ts +16 -0
- package/dist/excalidraw/animation-frame-handler.js +55 -0
- package/dist/excalidraw/appState.d.ts +1 -1
- package/dist/excalidraw/appState.js +1 -3
- package/dist/excalidraw/clipboard.js +5 -5
- package/dist/excalidraw/components/Actions.d.ts +3 -3
- package/dist/excalidraw/components/Actions.js +18 -7
- package/dist/excalidraw/components/App.d.ts +32 -17
- package/dist/excalidraw/components/App.js +474 -339
- package/dist/excalidraw/components/Button.d.ts +1 -1
- package/dist/excalidraw/components/FilledButton.d.ts +2 -2
- package/dist/excalidraw/components/FilledButton.js +27 -3
- package/dist/excalidraw/components/FollowMode/FollowMode.js +1 -1
- package/dist/excalidraw/components/ImageExportDialog.d.ts +2 -1
- package/dist/excalidraw/components/ImageExportDialog.js +16 -12
- package/dist/excalidraw/components/JSONExportDialog.js +1 -1
- package/dist/excalidraw/components/{LaserTool/LaserPointerButton.d.ts → LaserPointerButton.d.ts} +1 -1
- package/dist/excalidraw/components/{LaserTool/LaserPointerButton.js → LaserPointerButton.js} +2 -2
- package/dist/excalidraw/components/LayerUI.js +3 -3
- package/dist/excalidraw/components/MobileMenu.js +1 -1
- package/dist/excalidraw/components/ProjectName.d.ts +0 -1
- package/dist/excalidraw/components/ProjectName.js +1 -1
- package/dist/excalidraw/components/SVGLayer.d.ts +8 -0
- package/dist/excalidraw/components/SVGLayer.js +20 -0
- package/dist/excalidraw/components/ShareableLinkDialog.js +10 -10
- package/dist/excalidraw/components/Stack.d.ts +2 -2
- package/dist/excalidraw/components/TTDDialog/common.js +10 -1
- package/dist/excalidraw/components/TextField.d.ts +5 -2
- package/dist/excalidraw/components/TextField.js +6 -3
- package/dist/excalidraw/components/Toast.d.ts +3 -2
- package/dist/excalidraw/components/Toast.js +2 -2
- package/dist/excalidraw/components/ToolButton.js +2 -1
- package/dist/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -2
- package/dist/excalidraw/components/canvases/InteractiveCanvas.js +6 -5
- package/dist/excalidraw/components/canvases/StaticCanvas.d.ts +4 -3
- package/dist/excalidraw/components/canvases/StaticCanvas.js +7 -5
- package/dist/excalidraw/components/dropdownMenu/DropdownMenuContent.js +22 -2
- package/dist/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/excalidraw/components/hyperlink/Hyperlink.d.ts +19 -0
- package/dist/excalidraw/{element → components/hyperlink}/Hyperlink.js +40 -115
- package/dist/excalidraw/components/hyperlink/helpers.d.ts +7 -0
- package/dist/excalidraw/components/hyperlink/helpers.js +49 -0
- package/dist/excalidraw/components/icons.d.ts +2 -1
- package/dist/excalidraw/components/icons.js +2 -1
- package/dist/excalidraw/components/live-collaboration/LiveCollaborationTrigger.js +3 -2
- package/dist/excalidraw/components/main-menu/DefaultItems.js +5 -2
- package/dist/excalidraw/constants.d.ts +8 -0
- package/dist/excalidraw/constants.js +10 -0
- package/dist/excalidraw/data/blob.js +13 -14
- package/dist/excalidraw/data/filesystem.d.ts +1 -1
- package/dist/excalidraw/data/index.d.ts +2 -1
- package/dist/excalidraw/data/index.js +20 -16
- package/dist/excalidraw/data/json.d.ts +1 -1
- package/dist/excalidraw/data/json.js +5 -3
- package/dist/excalidraw/data/resave.d.ts +1 -1
- package/dist/excalidraw/data/resave.js +2 -2
- package/dist/excalidraw/data/restore.js +8 -13
- package/dist/excalidraw/data/transform.js +13 -9
- package/dist/excalidraw/distribute.d.ts +2 -2
- package/dist/excalidraw/distribute.js +2 -2
- package/dist/excalidraw/element/ElementCanvasButtons.d.ts +3 -2
- package/dist/excalidraw/element/ElementCanvasButtons.js +4 -4
- package/dist/excalidraw/element/binding.d.ts +9 -9
- package/dist/excalidraw/element/binding.js +61 -59
- package/dist/excalidraw/element/bounds.d.ts +5 -5
- package/dist/excalidraw/element/bounds.js +29 -32
- package/dist/excalidraw/element/collision.d.ts +11 -11
- package/dist/excalidraw/element/collision.js +49 -46
- package/dist/excalidraw/element/containerCache.d.ts +11 -0
- package/dist/excalidraw/element/containerCache.js +14 -0
- package/dist/excalidraw/element/dragElements.js +10 -19
- package/dist/excalidraw/element/embeddable.d.ts +11 -12
- package/dist/excalidraw/element/embeddable.js +17 -27
- package/dist/excalidraw/element/image.js +1 -2
- package/dist/excalidraw/element/index.d.ts +0 -1
- package/dist/excalidraw/element/index.js +0 -1
- package/dist/excalidraw/element/linearElementEditor.d.ts +35 -35
- package/dist/excalidraw/element/linearElementEditor.js +79 -80
- package/dist/excalidraw/element/newElement.d.ts +4 -6
- package/dist/excalidraw/element/newElement.js +11 -16
- package/dist/excalidraw/element/resizeElements.d.ts +6 -6
- package/dist/excalidraw/element/resizeElements.js +40 -46
- package/dist/excalidraw/element/resizeTest.d.ts +3 -3
- package/dist/excalidraw/element/resizeTest.js +4 -4
- package/dist/excalidraw/element/sizeHelpers.d.ts +2 -2
- package/dist/excalidraw/element/sizeHelpers.js +2 -2
- package/dist/excalidraw/element/textElement.d.ts +18 -20
- package/dist/excalidraw/element/textElement.js +80 -111
- package/dist/excalidraw/element/textWysiwyg.d.ts +1 -6
- package/dist/excalidraw/element/textWysiwyg.js +15 -37
- package/dist/excalidraw/element/transformHandles.d.ts +4 -4
- package/dist/excalidraw/element/transformHandles.js +6 -6
- package/dist/excalidraw/element/typeChecks.js +4 -1
- package/dist/excalidraw/element/types.d.ts +24 -11
- package/dist/excalidraw/emitter.d.ts +5 -9
- package/dist/excalidraw/emitter.js +12 -12
- package/dist/excalidraw/frame.d.ts +26 -20
- package/dist/excalidraw/frame.js +157 -84
- package/dist/excalidraw/groups.d.ts +3 -3
- package/dist/excalidraw/groups.js +11 -3
- package/dist/excalidraw/history.d.ts +1 -1
- package/dist/excalidraw/index.d.ts +7 -3
- package/dist/excalidraw/index.js +14 -5
- package/dist/excalidraw/laser-trails.d.ts +19 -0
- package/dist/excalidraw/laser-trails.js +95 -0
- package/dist/excalidraw/locales/en.json +9 -5
- package/dist/excalidraw/reactUtils.d.ts +14 -0
- package/dist/excalidraw/reactUtils.js +45 -0
- package/dist/excalidraw/renderer/helpers.d.ts +13 -0
- package/dist/excalidraw/renderer/helpers.js +39 -0
- package/dist/excalidraw/renderer/interactiveScene.d.ts +20 -0
- package/dist/excalidraw/renderer/{renderScene.js → interactiveScene.js} +199 -474
- package/dist/excalidraw/renderer/renderElement.d.ts +6 -6
- package/dist/excalidraw/renderer/renderElement.js +54 -366
- package/dist/excalidraw/renderer/staticScene.d.ts +11 -0
- package/dist/excalidraw/renderer/staticScene.js +205 -0
- package/dist/excalidraw/renderer/staticSvgScene.d.ts +5 -0
- package/dist/excalidraw/renderer/staticSvgScene.js +385 -0
- package/dist/excalidraw/scene/Fonts.js +2 -1
- package/dist/excalidraw/scene/Renderer.d.ts +1 -1
- package/dist/excalidraw/scene/Renderer.js +32 -20
- package/dist/excalidraw/scene/Scene.d.ts +10 -9
- package/dist/excalidraw/scene/Scene.js +45 -21
- package/dist/excalidraw/scene/Shape.d.ts +3 -1
- package/dist/excalidraw/scene/Shape.js +7 -5
- package/dist/excalidraw/scene/ShapeCache.d.ts +2 -1
- package/dist/excalidraw/scene/ShapeCache.js +1 -0
- package/dist/excalidraw/scene/comparisons.js +2 -1
- package/dist/excalidraw/scene/export.d.ts +3 -0
- package/dist/excalidraw/scene/export.js +20 -40
- package/dist/excalidraw/scene/index.d.ts +0 -1
- package/dist/excalidraw/scene/index.js +0 -1
- package/dist/excalidraw/scene/scrollbars.d.ts +1 -1
- package/dist/excalidraw/scene/scrollbars.js +1 -1
- package/dist/excalidraw/scene/selection.d.ts +5 -5
- package/dist/excalidraw/scene/selection.js +16 -14
- package/dist/excalidraw/scene/types.d.ts +11 -5
- package/dist/excalidraw/snapping.d.ts +7 -7
- package/dist/excalidraw/snapping.js +21 -20
- package/dist/excalidraw/types.d.ts +11 -12
- package/dist/excalidraw/utility-types.d.ts +5 -0
- package/dist/excalidraw/utils.d.ts +25 -16
- package/dist/excalidraw/utils.js +52 -45
- package/dist/{dev/en-RLIAOBCI.json → prod/en-TDNWCAOT.json} +9 -5
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +45 -45
- package/dist/utils/export.d.ts +0 -6
- package/dist/utils/export.js +0 -6
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/withinBounds.js +2 -1
- package/package.json +4 -4
- package/dist/browser/dev/excalidraw-assets-dev/chunk-2W5GQUR4.js.map +0 -7
- package/dist/browser/dev/excalidraw-assets-dev/chunk-SUHLFFEF.js +0 -53449
- package/dist/browser/dev/excalidraw-assets-dev/chunk-SUHLFFEF.js.map +0 -7
- package/dist/browser/dev/excalidraw-assets-dev/image-NOPDRTTM.css +0 -5797
- package/dist/browser/dev/excalidraw-assets-dev/image-NOPDRTTM.css.map +0 -7
- package/dist/browser/prod/excalidraw-assets/chunk-HE2P7BQ6.js +0 -257
- package/dist/browser/prod/excalidraw-assets/chunk-OWLL6VOG.js +0 -11
- package/dist/browser/prod/excalidraw-assets/en-ERQOR3OC.js +0 -1
- package/dist/browser/prod/excalidraw-assets/image-DZ6B4AID.js +0 -1
- package/dist/browser/prod/excalidraw-assets/image-J2QCCYAR.css +0 -1
- package/dist/excalidraw/components/LaserTool/LaserPathManager.d.ts +0 -28
- package/dist/excalidraw/components/LaserTool/LaserPathManager.js +0 -225
- package/dist/excalidraw/components/LaserTool/LaserTool.d.ts +0 -8
- package/dist/excalidraw/components/LaserTool/LaserTool.js +0 -15
- package/dist/excalidraw/renderer/renderScene.d.ts +0 -25
- package/dist/excalidraw/vite.config.d.mts +0 -2
- package/dist/excalidraw/vite.config.mjs +0 -13
- /package/dist/browser/dev/excalidraw-assets-dev/{en-OC6JWP3X.js.map → en-IOBA4CS2.js.map} +0 -0
- /package/dist/browser/dev/excalidraw-assets-dev/{image-HYNUJ3XL.js.map → image-VKDAL6BQ.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
1
|
+
import { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ElementsMapOrArray, ElementsMap } from "./element/types";
|
|
2
2
|
import { AppClassProperties, AppState, InteractiveCanvasAppState } from "./types";
|
|
3
3
|
import { Mutable } from "./utility-types";
|
|
4
4
|
export declare const selectGroup: (groupId: GroupId, appState: InteractiveCanvasAppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => Pick<InteractiveCanvasAppState, "selectedGroupIds" | "selectedElementIds" | "editingGroupId">;
|
|
@@ -18,7 +18,7 @@ export declare const selectGroupsFromGivenElements: (elements: readonly NonDelet
|
|
|
18
18
|
};
|
|
19
19
|
export declare const editGroupForSelectedElement: (appState: AppState, element: NonDeleted<ExcalidrawElement>) => AppState;
|
|
20
20
|
export declare const isElementInGroup: (element: ExcalidrawElement, groupId: string) => boolean;
|
|
21
|
-
export declare const getElementsInGroup: (elements:
|
|
21
|
+
export declare const getElementsInGroup: (elements: ElementsMapOrArray, groupId: string) => ExcalidrawElement[];
|
|
22
22
|
export declare const getSelectedGroupIdForElement: (element: ExcalidrawElement, selectedGroupIds: {
|
|
23
23
|
[groupId: string]: boolean;
|
|
24
24
|
}) => string | undefined;
|
|
@@ -27,5 +27,5 @@ export declare const addToGroup: (prevGroupIds: ExcalidrawElement["groupIds"], n
|
|
|
27
27
|
export declare const removeFromSelectedGroups: (groupIds: ExcalidrawElement["groupIds"], selectedGroupIds: {
|
|
28
28
|
[groupId: string]: boolean;
|
|
29
29
|
}) => string[];
|
|
30
|
-
export declare const getMaximumGroups: (elements: ExcalidrawElement[]) => ExcalidrawElement[][];
|
|
30
|
+
export declare const getMaximumGroups: (elements: ExcalidrawElement[], elementsMap: ElementsMap) => ExcalidrawElement[][];
|
|
31
31
|
export declare const elementsAreInSameGroup: (elements: ExcalidrawElement[]) => boolean;
|
|
@@ -171,7 +171,15 @@ export const editGroupForSelectedElement = (appState, element) => {
|
|
|
171
171
|
};
|
|
172
172
|
};
|
|
173
173
|
export const isElementInGroup = (element, groupId) => element.groupIds.includes(groupId);
|
|
174
|
-
export const getElementsInGroup = (elements, groupId) =>
|
|
174
|
+
export const getElementsInGroup = (elements, groupId) => {
|
|
175
|
+
const elementsInGroup = [];
|
|
176
|
+
for (const element of elements.values()) {
|
|
177
|
+
if (isElementInGroup(element, groupId)) {
|
|
178
|
+
elementsInGroup.push(element);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return elementsInGroup;
|
|
182
|
+
};
|
|
175
183
|
export const getSelectedGroupIdForElement = (element, selectedGroupIds) => element.groupIds.find((groupId) => selectedGroupIds[groupId]);
|
|
176
184
|
export const getNewGroupIdsForDuplication = (groupIds, editingGroupId, mapper) => {
|
|
177
185
|
const copy = [...groupIds];
|
|
@@ -195,7 +203,7 @@ export const addToGroup = (prevGroupIds, newGroupId, editingGroupId) => {
|
|
|
195
203
|
return groupIds;
|
|
196
204
|
};
|
|
197
205
|
export const removeFromSelectedGroups = (groupIds, selectedGroupIds) => groupIds.filter((groupId) => !selectedGroupIds[groupId]);
|
|
198
|
-
export const getMaximumGroups = (elements) => {
|
|
206
|
+
export const getMaximumGroups = (elements, elementsMap) => {
|
|
199
207
|
const groups = new Map();
|
|
200
208
|
elements.forEach((element) => {
|
|
201
209
|
const groupId = element.groupIds.length === 0
|
|
@@ -203,7 +211,7 @@ export const getMaximumGroups = (elements) => {
|
|
|
203
211
|
: element.groupIds[element.groupIds.length - 1];
|
|
204
212
|
const currentGroupMembers = groups.get(groupId) || [];
|
|
205
213
|
// Include bound text if present when grouping
|
|
206
|
-
const boundTextElement = getBoundTextElement(element);
|
|
214
|
+
const boundTextElement = getBoundTextElement(element, elementsMap);
|
|
207
215
|
if (boundTextElement) {
|
|
208
216
|
currentGroupMembers.push(boundTextElement);
|
|
209
217
|
}
|
|
@@ -14,7 +14,7 @@ declare const clearAppStatePropertiesForHistory: (appState: AppState) => {
|
|
|
14
14
|
viewBackgroundColor: string;
|
|
15
15
|
editingLinearElement: import("./element/linearElementEditor").LinearElementEditor | null;
|
|
16
16
|
editingGroupId: string | null;
|
|
17
|
-
name: string;
|
|
17
|
+
name: string | null;
|
|
18
18
|
};
|
|
19
19
|
declare class History {
|
|
20
20
|
private elementCache;
|
|
@@ -11,9 +11,13 @@ export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawPro
|
|
|
11
11
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "./element";
|
|
12
12
|
export { defaultLang, useI18n, languages } from "./i18n";
|
|
13
13
|
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "./data/restore";
|
|
14
|
-
export { exportToCanvas, exportToBlob, exportToSvg,
|
|
14
|
+
export { exportToCanvas, exportToBlob, exportToSvg, exportToClipboard, } from "../utils/export";
|
|
15
|
+
export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
|
|
16
|
+
export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "./data/blob";
|
|
17
|
+
export { getFreeDrawSvgPath } from "./renderer/renderElement";
|
|
18
|
+
export { mergeLibraryItems } from "./data/library";
|
|
15
19
|
export { isLinearElement } from "./element/typeChecks";
|
|
16
|
-
export { FONT_FAMILY, THEME, MIME_TYPES } from "./constants";
|
|
20
|
+
export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS } from "./constants";
|
|
17
21
|
export { mutateElement, newElementWith, bumpVersion, } from "./element/mutateElement";
|
|
18
22
|
export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
|
|
19
23
|
export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "./utils";
|
|
@@ -31,4 +35,4 @@ export { normalizeLink } from "./data/url";
|
|
|
31
35
|
export { zoomToFitBounds } from "./actions/actionCanvas";
|
|
32
36
|
export { convertToExcalidrawElements } from "./data/transform";
|
|
33
37
|
export { getCommonBounds, getVisibleSceneBounds } from "./element/bounds";
|
|
34
|
-
export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../utils/
|
|
38
|
+
export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../utils/withinBounds";
|
package/dist/excalidraw/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import WelcomeScreen from "./components/welcome-screen/WelcomeScreen";
|
|
|
17
17
|
import LiveCollaborationTrigger from "./components/live-collaboration/LiveCollaborationTrigger";
|
|
18
18
|
polyfill();
|
|
19
19
|
const ExcalidrawBase = (props) => {
|
|
20
|
-
const { onChange, initialData, excalidrawAPI, isCollaborating = false, onPointerUpdate, renderTopRightUI, langCode = defaultLang.code, viewModeEnabled, zenModeEnabled, gridModeEnabled, libraryReturnUrl, theme, name, renderCustomStats, onPaste, detectScroll = true, handleKeyboardGlobally = false, onLibraryChange, autoFocus = false, generateIdForFile, onLinkOpen, onPointerDown, onScrollChange, children, validateEmbeddable, renderEmbeddable, aiEnabled, } = props;
|
|
20
|
+
const { onChange, initialData, excalidrawAPI, isCollaborating = false, onPointerUpdate, renderTopRightUI, langCode = defaultLang.code, viewModeEnabled, zenModeEnabled, gridModeEnabled, libraryReturnUrl, theme, name, renderCustomStats, onPaste, detectScroll = true, handleKeyboardGlobally = false, onLibraryChange, autoFocus = false, generateIdForFile, onLinkOpen, onPointerDown, onPointerUp, onScrollChange, children, validateEmbeddable, renderEmbeddable, aiEnabled, } = props;
|
|
21
21
|
const canvasActions = props.UIOptions?.canvasActions;
|
|
22
22
|
// FIXME normalize/set defaults in parent component so that the memo resolver
|
|
23
23
|
// compares the same values
|
|
@@ -41,6 +41,11 @@ const ExcalidrawBase = (props) => {
|
|
|
41
41
|
UIOptions.canvasActions.toggleTheme = true;
|
|
42
42
|
}
|
|
43
43
|
useEffect(() => {
|
|
44
|
+
const importPolyfill = async () => {
|
|
45
|
+
//@ts-ignore
|
|
46
|
+
await import("canvas-roundrect-polyfill");
|
|
47
|
+
};
|
|
48
|
+
importPolyfill();
|
|
44
49
|
// Block pinch-zooming on iOS outside of the content area
|
|
45
50
|
const handleTouchMove = (event) => {
|
|
46
51
|
// @ts-ignore
|
|
@@ -55,7 +60,7 @@ const ExcalidrawBase = (props) => {
|
|
|
55
60
|
document.removeEventListener("touchmove", handleTouchMove);
|
|
56
61
|
};
|
|
57
62
|
}, []);
|
|
58
|
-
return (_jsx(Provider, { unstable_createStore: () => jotaiStore, scope: jotaiScope, children: _jsx(InitializeApp, { langCode: langCode, theme: theme, children: _jsx(App, { onChange: onChange, initialData: initialData, excalidrawAPI: excalidrawAPI, isCollaborating: isCollaborating, onPointerUpdate: onPointerUpdate, renderTopRightUI: renderTopRightUI, langCode: langCode, viewModeEnabled: viewModeEnabled, zenModeEnabled: zenModeEnabled, gridModeEnabled: gridModeEnabled, libraryReturnUrl: libraryReturnUrl, theme: theme, name: name, renderCustomStats: renderCustomStats, UIOptions: UIOptions, onPaste: onPaste, detectScroll: detectScroll, handleKeyboardGlobally: handleKeyboardGlobally, onLibraryChange: onLibraryChange, autoFocus: autoFocus, generateIdForFile: generateIdForFile, onLinkOpen: onLinkOpen, onPointerDown: onPointerDown, onScrollChange: onScrollChange, validateEmbeddable: validateEmbeddable, renderEmbeddable: renderEmbeddable, aiEnabled: aiEnabled !== false, children: children }) }) }));
|
|
63
|
+
return (_jsx(Provider, { unstable_createStore: () => jotaiStore, scope: jotaiScope, children: _jsx(InitializeApp, { langCode: langCode, theme: theme, children: _jsx(App, { onChange: onChange, initialData: initialData, excalidrawAPI: excalidrawAPI, isCollaborating: isCollaborating, onPointerUpdate: onPointerUpdate, renderTopRightUI: renderTopRightUI, langCode: langCode, viewModeEnabled: viewModeEnabled, zenModeEnabled: zenModeEnabled, gridModeEnabled: gridModeEnabled, libraryReturnUrl: libraryReturnUrl, theme: theme, name: name, renderCustomStats: renderCustomStats, UIOptions: UIOptions, onPaste: onPaste, detectScroll: detectScroll, handleKeyboardGlobally: handleKeyboardGlobally, onLibraryChange: onLibraryChange, autoFocus: autoFocus, generateIdForFile: generateIdForFile, onLinkOpen: onLinkOpen, onPointerDown: onPointerDown, onPointerUp: onPointerUp, onScrollChange: onScrollChange, validateEmbeddable: validateEmbeddable, renderEmbeddable: renderEmbeddable, aiEnabled: aiEnabled !== false, children: children }) }) }));
|
|
59
64
|
};
|
|
60
65
|
const areEqual = (prevProps, nextProps) => {
|
|
61
66
|
// short-circuit early
|
|
@@ -93,9 +98,13 @@ Excalidraw.displayName = "Excalidraw";
|
|
|
93
98
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "./element";
|
|
94
99
|
export { defaultLang, useI18n, languages } from "./i18n";
|
|
95
100
|
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "./data/restore";
|
|
96
|
-
export { exportToCanvas, exportToBlob, exportToSvg,
|
|
101
|
+
export { exportToCanvas, exportToBlob, exportToSvg, exportToClipboard, } from "../utils/export";
|
|
102
|
+
export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
|
|
103
|
+
export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "./data/blob";
|
|
104
|
+
export { getFreeDrawSvgPath } from "./renderer/renderElement";
|
|
105
|
+
export { mergeLibraryItems } from "./data/library";
|
|
97
106
|
export { isLinearElement } from "./element/typeChecks";
|
|
98
|
-
export { FONT_FAMILY, THEME, MIME_TYPES } from "./constants";
|
|
107
|
+
export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS } from "./constants";
|
|
99
108
|
export { mutateElement, newElementWith, bumpVersion, } from "./element/mutateElement";
|
|
100
109
|
export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
|
|
101
110
|
export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "./utils";
|
|
@@ -113,4 +122,4 @@ export { normalizeLink } from "./data/url";
|
|
|
113
122
|
export { zoomToFitBounds } from "./actions/actionCanvas";
|
|
114
123
|
export { convertToExcalidrawElements } from "./data/transform";
|
|
115
124
|
export { getCommonBounds, getVisibleSceneBounds } from "./element/bounds";
|
|
116
|
-
export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../utils/
|
|
125
|
+
export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../utils/withinBounds";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AnimatedTrail, Trail } from "./animated-trail";
|
|
2
|
+
import { AnimationFrameHandler } from "./animation-frame-handler";
|
|
3
|
+
import type App from "./components/App";
|
|
4
|
+
export declare class LaserTrails implements Trail {
|
|
5
|
+
private animationFrameHandler;
|
|
6
|
+
private app;
|
|
7
|
+
localTrail: AnimatedTrail;
|
|
8
|
+
private collabTrails;
|
|
9
|
+
private container?;
|
|
10
|
+
constructor(animationFrameHandler: AnimationFrameHandler, app: App);
|
|
11
|
+
private getTrailOptions;
|
|
12
|
+
startPath(x: number, y: number): void;
|
|
13
|
+
addPointToPath(x: number, y: number): void;
|
|
14
|
+
endPath(): void;
|
|
15
|
+
start(container: SVGSVGElement): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
onFrame(): void;
|
|
18
|
+
private updateCollabTrails;
|
|
19
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AnimatedTrail } from "./animated-trail";
|
|
2
|
+
import { easeOut } from "./utils";
|
|
3
|
+
import { getClientColor } from "./clients";
|
|
4
|
+
export class LaserTrails {
|
|
5
|
+
animationFrameHandler;
|
|
6
|
+
app;
|
|
7
|
+
localTrail;
|
|
8
|
+
collabTrails = new Map();
|
|
9
|
+
container;
|
|
10
|
+
constructor(animationFrameHandler, app) {
|
|
11
|
+
this.animationFrameHandler = animationFrameHandler;
|
|
12
|
+
this.app = app;
|
|
13
|
+
this.animationFrameHandler.register(this, this.onFrame.bind(this));
|
|
14
|
+
this.localTrail = new AnimatedTrail(animationFrameHandler, app, {
|
|
15
|
+
...this.getTrailOptions(),
|
|
16
|
+
fill: () => "red",
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
getTrailOptions() {
|
|
20
|
+
return {
|
|
21
|
+
simplify: 0,
|
|
22
|
+
streamline: 0.4,
|
|
23
|
+
sizeMapping: (c) => {
|
|
24
|
+
const DECAY_TIME = 1000;
|
|
25
|
+
const DECAY_LENGTH = 50;
|
|
26
|
+
const t = Math.max(0, 1 - (performance.now() - c.pressure) / DECAY_TIME);
|
|
27
|
+
const l = (DECAY_LENGTH -
|
|
28
|
+
Math.min(DECAY_LENGTH, c.totalLength - c.currentIndex)) /
|
|
29
|
+
DECAY_LENGTH;
|
|
30
|
+
return Math.min(easeOut(l), easeOut(t));
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
startPath(x, y) {
|
|
35
|
+
this.localTrail.startPath(x, y);
|
|
36
|
+
}
|
|
37
|
+
addPointToPath(x, y) {
|
|
38
|
+
this.localTrail.addPointToPath(x, y);
|
|
39
|
+
}
|
|
40
|
+
endPath() {
|
|
41
|
+
this.localTrail.endPath();
|
|
42
|
+
}
|
|
43
|
+
start(container) {
|
|
44
|
+
this.container = container;
|
|
45
|
+
this.animationFrameHandler.start(this);
|
|
46
|
+
this.localTrail.start(container);
|
|
47
|
+
}
|
|
48
|
+
stop() {
|
|
49
|
+
this.animationFrameHandler.stop(this);
|
|
50
|
+
this.localTrail.stop();
|
|
51
|
+
}
|
|
52
|
+
onFrame() {
|
|
53
|
+
this.updateCollabTrails();
|
|
54
|
+
}
|
|
55
|
+
updateCollabTrails() {
|
|
56
|
+
if (!this.container || this.app.state.collaborators.size === 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
for (const [key, collabolator] of this.app.state.collaborators.entries()) {
|
|
60
|
+
let trail;
|
|
61
|
+
if (!this.collabTrails.has(key)) {
|
|
62
|
+
trail = new AnimatedTrail(this.animationFrameHandler, this.app, {
|
|
63
|
+
...this.getTrailOptions(),
|
|
64
|
+
fill: () => getClientColor(key),
|
|
65
|
+
});
|
|
66
|
+
trail.start(this.container);
|
|
67
|
+
this.collabTrails.set(key, trail);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
trail = this.collabTrails.get(key);
|
|
71
|
+
}
|
|
72
|
+
if (collabolator.pointer && collabolator.pointer.tool === "laser") {
|
|
73
|
+
if (collabolator.button === "down" && !trail.hasCurrentTrail) {
|
|
74
|
+
trail.startPath(collabolator.pointer.x, collabolator.pointer.y);
|
|
75
|
+
}
|
|
76
|
+
if (collabolator.button === "down" &&
|
|
77
|
+
trail.hasCurrentTrail &&
|
|
78
|
+
!trail.hasLastPoint(collabolator.pointer.x, collabolator.pointer.y)) {
|
|
79
|
+
trail.addPointToPath(collabolator.pointer.x, collabolator.pointer.y);
|
|
80
|
+
}
|
|
81
|
+
if (collabolator.button === "up" && trail.hasCurrentTrail) {
|
|
82
|
+
trail.addPointToPath(collabolator.pointer.x, collabolator.pointer.y);
|
|
83
|
+
trail.endPath();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
for (const key of this.collabTrails.keys()) {
|
|
88
|
+
if (!this.app.state.collaborators.has(key)) {
|
|
89
|
+
const trail = this.collabTrails.get(key);
|
|
90
|
+
trail.stop();
|
|
91
|
+
this.collabTrails.delete(key);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -138,7 +138,9 @@
|
|
|
138
138
|
"removeAllElementsFromFrame": "Remove all elements from frame",
|
|
139
139
|
"eyeDropper": "Pick color from canvas",
|
|
140
140
|
"textToDiagram": "Text to diagram",
|
|
141
|
-
"prompt": "Prompt"
|
|
141
|
+
"prompt": "Prompt",
|
|
142
|
+
"followUs": "Follow us",
|
|
143
|
+
"discordChat": "Discord chat"
|
|
142
144
|
},
|
|
143
145
|
"library": {
|
|
144
146
|
"noItems": "No items added yet...",
|
|
@@ -212,7 +214,6 @@
|
|
|
212
214
|
"fileTooBig": "File is too big. Maximum allowed size is {{maxSize}}.",
|
|
213
215
|
"svgImageInsertError": "Couldn't insert SVG image. The SVG markup looks invalid.",
|
|
214
216
|
"failedToFetchImage": "Failed to fetch image.",
|
|
215
|
-
"invalidSVGString": "Invalid SVG.",
|
|
216
217
|
"cannotResolveCollabServer": "Couldn't connect to the collab server. Please reload the page and try again.",
|
|
217
218
|
"importLibraryError": "Couldn't load library",
|
|
218
219
|
"collabSaveFailed": "Couldn't save to the backend database. If problems persist, you should save your file locally to ensure you don't lose your work.",
|
|
@@ -246,7 +247,7 @@
|
|
|
246
247
|
"library": "Library",
|
|
247
248
|
"lock": "Keep selected tool active after drawing",
|
|
248
249
|
"penMode": "Pen mode - prevent touch",
|
|
249
|
-
"link": "Add/ Update link for a selected shape",
|
|
250
|
+
"link": "Add / Update link for a selected shape",
|
|
250
251
|
"eraser": "Eraser",
|
|
251
252
|
"frame": "Frame tool",
|
|
252
253
|
"magicframe": "Wireframe to code",
|
|
@@ -299,9 +300,12 @@
|
|
|
299
300
|
"openIssueMessage": "We were very cautious not to include your scene information on the error. If your scene is not private, please consider following up on our <button>bug tracker</button>. Please include information below by copying and pasting into the GitHub issue.",
|
|
300
301
|
"sceneContent": "Scene content:"
|
|
301
302
|
},
|
|
303
|
+
"shareDialog": {
|
|
304
|
+
"or": "Or"
|
|
305
|
+
},
|
|
302
306
|
"roomDialog": {
|
|
303
|
-
"desc_intro": "
|
|
304
|
-
"desc_privacy": "Don't worry, the session
|
|
307
|
+
"desc_intro": "Invite people to collaborate on your drawing.",
|
|
308
|
+
"desc_privacy": "Don't worry, the session is end-to-end encrypted, and fully private. Not even our server can see what you draw.",
|
|
305
309
|
"button_startSession": "Start session",
|
|
306
310
|
"button_stopSession": "Stop session",
|
|
307
311
|
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param func handler taking at most single parameter (event).
|
|
3
|
+
*/
|
|
4
|
+
export declare const withBatchedUpdates: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => TFunction;
|
|
5
|
+
/**
|
|
6
|
+
* barches React state updates and throttles the calls to a single call per
|
|
7
|
+
* animation frame
|
|
8
|
+
*/
|
|
9
|
+
export declare const withBatchedUpdatesThrottled: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => {
|
|
10
|
+
(...args: Parameters<TFunction>): void;
|
|
11
|
+
flush(): void;
|
|
12
|
+
cancel(): void;
|
|
13
|
+
};
|
|
14
|
+
export declare const isRenderThrottlingEnabled: () => boolean;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param func handler taking at most single parameter (event).
|
|
3
|
+
*/
|
|
4
|
+
import { unstable_batchedUpdates } from "react-dom";
|
|
5
|
+
import { version as ReactVersion } from "react";
|
|
6
|
+
import { throttleRAF } from "./utils";
|
|
7
|
+
export const withBatchedUpdates = (func) => ((event) => {
|
|
8
|
+
unstable_batchedUpdates(func, event);
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* barches React state updates and throttles the calls to a single call per
|
|
12
|
+
* animation frame
|
|
13
|
+
*/
|
|
14
|
+
export const withBatchedUpdatesThrottled = (func) => {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
return throttleRAF(((event) => {
|
|
17
|
+
unstable_batchedUpdates(func, event);
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
export const isRenderThrottlingEnabled = (() => {
|
|
21
|
+
// we don't want to throttle in react < 18 because of #5439 and it was
|
|
22
|
+
// getting more complex to maintain the fix
|
|
23
|
+
let IS_REACT_18_AND_UP;
|
|
24
|
+
try {
|
|
25
|
+
const version = ReactVersion.split(".");
|
|
26
|
+
IS_REACT_18_AND_UP = Number(version[0]) > 17;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
IS_REACT_18_AND_UP = false;
|
|
30
|
+
}
|
|
31
|
+
let hasWarned = false;
|
|
32
|
+
return () => {
|
|
33
|
+
if (window.EXCALIDRAW_THROTTLE_RENDER === true) {
|
|
34
|
+
if (!IS_REACT_18_AND_UP) {
|
|
35
|
+
if (!hasWarned) {
|
|
36
|
+
hasWarned = true;
|
|
37
|
+
console.warn("Excalidraw: render throttling is disabled on React versions < 18.");
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StaticCanvasAppState, AppState } from "../types";
|
|
2
|
+
import { StaticCanvasRenderConfig } from "../scene/types";
|
|
3
|
+
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: boolean) => void;
|
|
4
|
+
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
5
|
+
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
6
|
+
canvas: HTMLCanvasElement;
|
|
7
|
+
scale: number;
|
|
8
|
+
normalizedWidth: number;
|
|
9
|
+
normalizedHeight: number;
|
|
10
|
+
theme?: import("../element/types").Theme | undefined;
|
|
11
|
+
isExporting?: boolean | undefined;
|
|
12
|
+
viewBackgroundColor?: string | null | undefined;
|
|
13
|
+
}) => CanvasRenderingContext2D;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { THEME_FILTER } from "../constants";
|
|
2
|
+
export const fillCircle = (context, cx, cy, radius, stroke = true) => {
|
|
3
|
+
context.beginPath();
|
|
4
|
+
context.arc(cx, cy, radius, 0, Math.PI * 2);
|
|
5
|
+
context.fill();
|
|
6
|
+
if (stroke) {
|
|
7
|
+
context.stroke();
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export const getNormalizedCanvasDimensions = (canvas, scale) => {
|
|
11
|
+
// When doing calculations based on canvas width we should used normalized one
|
|
12
|
+
return [canvas.width / scale, canvas.height / scale];
|
|
13
|
+
};
|
|
14
|
+
export const bootstrapCanvas = ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }) => {
|
|
15
|
+
const context = canvas.getContext("2d");
|
|
16
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
17
|
+
context.scale(scale, scale);
|
|
18
|
+
if (isExporting && theme === "dark") {
|
|
19
|
+
context.filter = THEME_FILTER;
|
|
20
|
+
}
|
|
21
|
+
// Paint background
|
|
22
|
+
if (typeof viewBackgroundColor === "string") {
|
|
23
|
+
const hasTransparence = viewBackgroundColor === "transparent" ||
|
|
24
|
+
viewBackgroundColor.length === 5 || // #RGBA
|
|
25
|
+
viewBackgroundColor.length === 9 || // #RRGGBBA
|
|
26
|
+
/(hsla|rgba)\(/.test(viewBackgroundColor);
|
|
27
|
+
if (hasTransparence) {
|
|
28
|
+
context.clearRect(0, 0, normalizedWidth, normalizedHeight);
|
|
29
|
+
}
|
|
30
|
+
context.save();
|
|
31
|
+
context.fillStyle = viewBackgroundColor;
|
|
32
|
+
context.fillRect(0, 0, normalizedWidth, normalizedHeight);
|
|
33
|
+
context.restore();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
context.clearRect(0, 0, normalizedWidth, normalizedHeight);
|
|
37
|
+
}
|
|
38
|
+
return context;
|
|
39
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
|
|
2
|
+
/** throttled to animation framerate */
|
|
3
|
+
export declare const renderInteractiveSceneThrottled: {
|
|
4
|
+
(config: InteractiveSceneRenderConfig): void;
|
|
5
|
+
flush(): void;
|
|
6
|
+
cancel(): void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Interactive scene is the ui-canvas where we render bounding boxes, selections
|
|
10
|
+
* and other ui stuff.
|
|
11
|
+
*/
|
|
12
|
+
export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, scale, appState, renderConfig, }: InteractiveSceneRenderConfig) => {
|
|
13
|
+
atLeastOneVisibleElement: boolean;
|
|
14
|
+
elementsMap: RenderableElementsMap;
|
|
15
|
+
scrollBars?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
scrollBars: import("../scene/types").ScrollBars | undefined;
|
|
18
|
+
atLeastOneVisibleElement: boolean;
|
|
19
|
+
elementsMap: RenderableElementsMap;
|
|
20
|
+
}, T extends boolean = false>(renderConfig: InteractiveSceneRenderConfig, throttle?: T | undefined) => T extends true ? void : ReturnType<U>;
|