@tldraw/editor 3.14.0-canary.ff61ab6deaa2 → 3.14.0-internal.601adf6e424b
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-cjs/index.d.ts +74 -46
- package/dist-cjs/index.js +1 -3
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/config/TLSessionStateSnapshot.js +1 -12
- package/dist-cjs/lib/config/TLSessionStateSnapshot.js.map +3 -3
- package/dist-cjs/lib/editor/Editor.js +62 -21
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +1 -2
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +73 -42
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +1 -1
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +1 -1
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +1 -1
- package/dist-cjs/lib/editor/tools/StateNode.js +3 -3
- package/dist-cjs/lib/editor/tools/StateNode.js.map +2 -2
- package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
- package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
- package/dist-cjs/lib/hooks/useCanvasEvents.js +1 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/primitives/Box.js +0 -6
- package/dist-cjs/lib/primitives/Box.js.map +2 -2
- package/dist-cjs/lib/utils/areShapesContentEqual.js +1 -1
- package/dist-cjs/lib/utils/areShapesContentEqual.js.map +2 -2
- package/dist-cjs/lib/utils/richText.js +7 -2
- package/dist-cjs/lib/utils/richText.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +74 -46
- package/dist-esm/index.mjs +1 -3
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/config/TLSessionStateSnapshot.mjs +1 -1
- package/dist-esm/lib/config/TLSessionStateSnapshot.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +62 -21
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +1 -2
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +73 -42
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +1 -1
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/editor/tools/StateNode.mjs +3 -3
- package/dist-esm/lib/editor/tools/StateNode.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +1 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/primitives/Box.mjs +0 -6
- package/dist-esm/lib/primitives/Box.mjs.map +2 -2
- package/dist-esm/lib/utils/areShapesContentEqual.mjs +1 -1
- package/dist-esm/lib/utils/areShapesContentEqual.mjs.map +2 -2
- package/dist-esm/lib/utils/richText.mjs +8 -3
- package/dist-esm/lib/utils/richText.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +433 -482
- package/package.json +8 -9
- package/src/index.ts +2 -1
- package/src/lib/config/TLSessionStateSnapshot.ts +1 -1
- package/src/lib/editor/Editor.test.ts +252 -3
- package/src/lib/editor/Editor.ts +61 -18
- package/src/lib/editor/bindings/BindingUtil.ts +6 -0
- package/src/lib/editor/managers/FontManager/FontManager.ts +1 -2
- package/src/lib/editor/managers/TextManager/TextManager.test.ts +1 -5
- package/src/lib/editor/managers/TextManager/TextManager.ts +118 -86
- package/src/lib/editor/shapes/ShapeUtil.ts +1 -0
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +1 -1
- package/src/lib/editor/tools/StateNode.ts +3 -3
- package/src/lib/editor/types/emit-types.ts +4 -0
- package/src/lib/editor/types/external-content.ts +11 -2
- package/src/lib/hooks/useCanvasEvents.ts +0 -1
- package/src/lib/primitives/Box.ts +0 -8
- package/src/lib/utils/areShapesContentEqual.ts +1 -2
- package/src/lib/utils/richText.ts +9 -3
- package/src/version.ts +3 -3
|
@@ -123,8 +123,8 @@ var import_TextManager = require("./managers/TextManager/TextManager");
|
|
|
123
123
|
var import_TickManager = require("./managers/TickManager/TickManager");
|
|
124
124
|
var import_UserPreferencesManager = require("./managers/UserPreferencesManager/UserPreferencesManager");
|
|
125
125
|
var import_RootState = require("./tools/RootState");
|
|
126
|
-
var __setMetaKeyTimeout_dec, __setCtrlKeyTimeout_dec, __setAltKeyTimeout_dec, __setShiftKeyTimeout_dec, _getIsReadonly_dec, _getIsFocused_dec, _getSharedOpacity_dec, _getSharedStyles_dec, __getSelectionSharedStyles_dec, __getBindingsIndexCache_dec, _getCurrentPageRenderingShapesSorted_dec, _getCurrentPageShapesSorted_dec, _getCurrentPageShapes_dec, _getCurrentPageBounds_dec, _getCulledShapes_dec,
|
|
127
|
-
class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_dec = [import_state.computed], _getCanUndo_dec = [import_state.computed], _getCanRedo_dec = [import_state.computed], _getPath_dec = [import_state.computed], _getCurrentTool_dec = [import_state.computed], _getCurrentToolId_dec = [import_state.computed], _getDocumentSettings_dec = [import_state.computed], _getInstanceState_dec = [import_state.computed], _getOpenMenus_dec = [import_state.computed], _getIsMenuOpen_dec = [import_state.computed], _getPageStates_dec = [import_state.computed], __getPageStatesQuery_dec = [import_state.computed], _getCurrentPageState_dec = [import_state.computed], __getCurrentPageStateId_dec = [import_state.computed], _getSelectedShapeIds_dec = [import_state.computed], _getSelectedShapes_dec = [import_state.computed], _getCurrentPageShapesInReadingOrder_dec = [import_state.computed], _getOnlySelectedShapeId_dec = [import_state.computed], _getOnlySelectedShape_dec = [import_state.computed], _getSelectionPageBounds_dec = [import_state.computed], _getSelectionRotation_dec = [import_state.computed], _getSelectionRotatedPageBounds_dec = [import_state.computed], _getSelectionRotatedScreenBounds_dec = [import_state.computed], _getFocusedGroupId_dec = [import_state.computed], _getFocusedGroup_dec = [import_state.computed], _getEditingShapeId_dec = [import_state.computed], _getEditingShape_dec = [import_state.computed], _getRichTextEditor_dec = [import_state.computed], _getHoveredShapeId_dec = [import_state.computed], _getHoveredShape_dec = [import_state.computed], _getHintingShapeIds_dec = [import_state.computed], _getHintingShape_dec = [import_state.computed], _getErasingShapeIds_dec = [import_state.computed], _getErasingShapes_dec = [import_state.computed], __unsafe_getCameraId_dec = [import_state.computed], _getCamera_dec = [import_state.computed], _getViewportPageBoundsForFollowing_dec = [import_state.computed], _getCameraForFollowing_dec = [import_state.computed], _getZoomLevel_dec = [import_state.computed], _getViewportScreenBounds_dec = [import_state.computed], _getViewportScreenCenter_dec = [import_state.computed], _getViewportPageBounds_dec = [import_state.computed], __getCollaboratorsQuery_dec = [import_state.computed], _getCollaborators_dec = [import_state.computed], _getCollaboratorsOnCurrentPage_dec = [import_state.computed], _getRenderingShapes_dec = [import_state.computed], __getAllPagesQuery_dec = [import_state.computed], _getPages_dec = [import_state.computed], _getCurrentPageId_dec = [import_state.computed], _getCurrentPageShapeIdsSorted_dec = [import_state.computed], __getAllAssetsQuery_dec = [import_state.computed], __getShapeHandlesCache_dec = [import_state.computed], __getShapePageTransformCache_dec = [import_state.computed], __getShapePageBoundsCache_dec = [import_state.computed], __getShapeClipPathCache_dec = [import_state.computed], __getShapeMaskCache_dec = [import_state.computed], __getShapeMaskedPageBoundsCache_dec = [import_state.computed],
|
|
126
|
+
var __setMetaKeyTimeout_dec, __setCtrlKeyTimeout_dec, __setAltKeyTimeout_dec, __setShiftKeyTimeout_dec, _getIsReadonly_dec, _getIsFocused_dec, _getSharedOpacity_dec, _getSharedStyles_dec, __getSelectionSharedStyles_dec, __getBindingsIndexCache_dec, _getCurrentPageRenderingShapesSorted_dec, _getCurrentPageShapesSorted_dec, _getCurrentPageShapes_dec, _getCurrentPageBounds_dec, _getCulledShapes_dec, _getNotVisibleShapes_dec, __getShapeMaskedPageBoundsCache_dec, __getShapeMaskCache_dec, __getShapeClipPathCache_dec, __getShapePageBoundsCache_dec, __getShapePageTransformCache_dec, __getShapeHandlesCache_dec, __getAllAssetsQuery_dec, _getCurrentPageShapeIdsSorted_dec, _getCurrentPageId_dec, _getPages_dec, __getAllPagesQuery_dec, _getRenderingShapes_dec, _getCollaboratorsOnCurrentPage_dec, _getCollaborators_dec, __getCollaboratorsQuery_dec, _getViewportPageBounds_dec, _getViewportScreenCenter_dec, _getViewportScreenBounds_dec, _getZoomLevel_dec, _getCameraForFollowing_dec, _getViewportPageBoundsForFollowing_dec, _getCamera_dec, __unsafe_getCameraId_dec, _getErasingShapes_dec, _getErasingShapeIds_dec, _getHintingShape_dec, _getHintingShapeIds_dec, _getHoveredShape_dec, _getHoveredShapeId_dec, _getRichTextEditor_dec, _getEditingShape_dec, _getEditingShapeId_dec, _getFocusedGroup_dec, _getFocusedGroupId_dec, _getSelectionRotatedScreenBounds_dec, _getSelectionRotatedPageBounds_dec, _getSelectionRotation_dec, _getSelectionPageBounds_dec, _getOnlySelectedShape_dec, _getOnlySelectedShapeId_dec, _getCurrentPageShapesInReadingOrder_dec, _getSelectedShapes_dec, _getSelectedShapeIds_dec, __getCurrentPageStateId_dec, _getCurrentPageState_dec, __getPageStatesQuery_dec, _getPageStates_dec, _getIsMenuOpen_dec, _getOpenMenus_dec, _getInstanceState_dec, _getDocumentSettings_dec, _getCurrentToolId_dec, _getCurrentTool_dec, _getPath_dec, _getCanRedo_dec, _getCanUndo_dec, _getIsShapeHiddenCache_dec, _a, _init;
|
|
127
|
+
class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_dec = [import_state.computed], _getCanUndo_dec = [import_state.computed], _getCanRedo_dec = [import_state.computed], _getPath_dec = [import_state.computed], _getCurrentTool_dec = [import_state.computed], _getCurrentToolId_dec = [import_state.computed], _getDocumentSettings_dec = [import_state.computed], _getInstanceState_dec = [import_state.computed], _getOpenMenus_dec = [import_state.computed], _getIsMenuOpen_dec = [import_state.computed], _getPageStates_dec = [import_state.computed], __getPageStatesQuery_dec = [import_state.computed], _getCurrentPageState_dec = [import_state.computed], __getCurrentPageStateId_dec = [import_state.computed], _getSelectedShapeIds_dec = [import_state.computed], _getSelectedShapes_dec = [import_state.computed], _getCurrentPageShapesInReadingOrder_dec = [import_state.computed], _getOnlySelectedShapeId_dec = [import_state.computed], _getOnlySelectedShape_dec = [import_state.computed], _getSelectionPageBounds_dec = [import_state.computed], _getSelectionRotation_dec = [import_state.computed], _getSelectionRotatedPageBounds_dec = [import_state.computed], _getSelectionRotatedScreenBounds_dec = [import_state.computed], _getFocusedGroupId_dec = [import_state.computed], _getFocusedGroup_dec = [import_state.computed], _getEditingShapeId_dec = [import_state.computed], _getEditingShape_dec = [import_state.computed], _getRichTextEditor_dec = [import_state.computed], _getHoveredShapeId_dec = [import_state.computed], _getHoveredShape_dec = [import_state.computed], _getHintingShapeIds_dec = [import_state.computed], _getHintingShape_dec = [import_state.computed], _getErasingShapeIds_dec = [import_state.computed], _getErasingShapes_dec = [import_state.computed], __unsafe_getCameraId_dec = [import_state.computed], _getCamera_dec = [import_state.computed], _getViewportPageBoundsForFollowing_dec = [import_state.computed], _getCameraForFollowing_dec = [import_state.computed], _getZoomLevel_dec = [import_state.computed], _getViewportScreenBounds_dec = [import_state.computed], _getViewportScreenCenter_dec = [import_state.computed], _getViewportPageBounds_dec = [import_state.computed], __getCollaboratorsQuery_dec = [import_state.computed], _getCollaborators_dec = [import_state.computed], _getCollaboratorsOnCurrentPage_dec = [import_state.computed], _getRenderingShapes_dec = [import_state.computed], __getAllPagesQuery_dec = [import_state.computed], _getPages_dec = [import_state.computed], _getCurrentPageId_dec = [import_state.computed], _getCurrentPageShapeIdsSorted_dec = [import_state.computed], __getAllAssetsQuery_dec = [import_state.computed], __getShapeHandlesCache_dec = [import_state.computed], __getShapePageTransformCache_dec = [import_state.computed], __getShapePageBoundsCache_dec = [import_state.computed], __getShapeClipPathCache_dec = [import_state.computed], __getShapeMaskCache_dec = [import_state.computed], __getShapeMaskedPageBoundsCache_dec = [import_state.computed], _getNotVisibleShapes_dec = [import_state.computed], _getCulledShapes_dec = [import_state.computed], _getCurrentPageBounds_dec = [import_state.computed], _getCurrentPageShapes_dec = [import_state.computed], _getCurrentPageShapesSorted_dec = [import_state.computed], _getCurrentPageRenderingShapesSorted_dec = [import_state.computed], __getBindingsIndexCache_dec = [import_state.computed], __getSelectionSharedStyles_dec = [import_state.computed], _getSharedStyles_dec = [(0, import_state.computed)({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [import_state.computed], _getIsFocused_dec = [import_state.computed], _getIsReadonly_dec = [import_state.computed], __setShiftKeyTimeout_dec = [import_utils.bind], __setAltKeyTimeout_dec = [import_utils.bind], __setCtrlKeyTimeout_dec = [import_utils.bind], __setMetaKeyTimeout_dec = [import_utils.bind], _a) {
|
|
128
128
|
constructor({
|
|
129
129
|
store,
|
|
130
130
|
user,
|
|
@@ -302,6 +302,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
302
302
|
__publicField(this, "_currentPageShapeIds");
|
|
303
303
|
/* --------------------- Shapes --------------------- */
|
|
304
304
|
__publicField(this, "_shapeGeometryCaches", {});
|
|
305
|
+
__publicField(this, "_notVisibleShapes", (0, import_notVisibleShapes.notVisibleShapes)(this));
|
|
305
306
|
// Parents and children
|
|
306
307
|
/**
|
|
307
308
|
* A cache of parents to children.
|
|
@@ -322,6 +323,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
322
323
|
__publicField(this, "externalContentHandlers", {
|
|
323
324
|
text: null,
|
|
324
325
|
files: null,
|
|
326
|
+
"file-replace": null,
|
|
325
327
|
embed: null,
|
|
326
328
|
"svg-text": null,
|
|
327
329
|
url: null,
|
|
@@ -438,6 +440,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
438
440
|
this.disposables.add(() => this.user.dispose());
|
|
439
441
|
this.getContainer = getContainer;
|
|
440
442
|
this.textMeasure = new import_TextManager.TextManager(this);
|
|
443
|
+
this.disposables.add(() => this.textMeasure.dispose());
|
|
441
444
|
this.fonts = new import_FontManager.FontManager(this, fontAssetUrls);
|
|
442
445
|
this._tickManager = new import_TickManager.TickManager(this);
|
|
443
446
|
class NewRoot extends import_RootState.RootState {
|
|
@@ -558,20 +561,21 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
558
561
|
shape: {
|
|
559
562
|
afterChange: (shapeBefore, shapeAfter) => {
|
|
560
563
|
for (const binding of this.getBindingsInvolvingShape(shapeAfter)) {
|
|
561
|
-
if ((0, import_areShapesContentEqual.areShapesContentEqual)(shapeBefore, shapeAfter)) continue;
|
|
562
564
|
invalidBindingTypes.add(binding.type);
|
|
563
565
|
if (binding.fromId === shapeAfter.id) {
|
|
564
566
|
this.getBindingUtil(binding).onAfterChangeFromShape?.({
|
|
565
567
|
binding,
|
|
566
568
|
shapeBefore,
|
|
567
|
-
shapeAfter
|
|
569
|
+
shapeAfter,
|
|
570
|
+
reason: "self"
|
|
568
571
|
});
|
|
569
572
|
}
|
|
570
573
|
if (binding.toId === shapeAfter.id) {
|
|
571
574
|
this.getBindingUtil(binding).onAfterChangeToShape?.({
|
|
572
575
|
binding,
|
|
573
576
|
shapeBefore,
|
|
574
|
-
shapeAfter
|
|
577
|
+
shapeAfter,
|
|
578
|
+
reason: "self"
|
|
575
579
|
});
|
|
576
580
|
}
|
|
577
581
|
}
|
|
@@ -585,14 +589,16 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
585
589
|
this.getBindingUtil(binding).onAfterChangeFromShape?.({
|
|
586
590
|
binding,
|
|
587
591
|
shapeBefore: descendantShape,
|
|
588
|
-
shapeAfter: descendantShape
|
|
592
|
+
shapeAfter: descendantShape,
|
|
593
|
+
reason: "ancestry"
|
|
589
594
|
});
|
|
590
595
|
}
|
|
591
596
|
if (binding.toId === descendantShape.id) {
|
|
592
597
|
this.getBindingUtil(binding).onAfterChangeToShape?.({
|
|
593
598
|
binding,
|
|
594
599
|
shapeBefore: descendantShape,
|
|
595
|
-
shapeAfter: descendantShape
|
|
600
|
+
shapeAfter: descendantShape,
|
|
601
|
+
reason: "ancestry"
|
|
596
602
|
});
|
|
597
603
|
}
|
|
598
604
|
}
|
|
@@ -1636,6 +1642,19 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
1636
1642
|
getSelectionPageBounds() {
|
|
1637
1643
|
return this.getShapesPageBounds(this.getSelectedShapeIds());
|
|
1638
1644
|
}
|
|
1645
|
+
/**
|
|
1646
|
+
* The bounds of the selection bounding box in the current page space.
|
|
1647
|
+
*
|
|
1648
|
+
* @readonly
|
|
1649
|
+
* @public
|
|
1650
|
+
*/
|
|
1651
|
+
getSelectionScreenBounds() {
|
|
1652
|
+
const bounds = this.getSelectionPageBounds();
|
|
1653
|
+
if (!bounds) return void 0;
|
|
1654
|
+
const { x, y } = this.pageToScreen(bounds.point);
|
|
1655
|
+
const zoom = this.getZoomLevel();
|
|
1656
|
+
return new import_Box.Box(x, y, bounds.width * zoom, bounds.height * zoom);
|
|
1657
|
+
}
|
|
1639
1658
|
/**
|
|
1640
1659
|
* @internal
|
|
1641
1660
|
*/
|
|
@@ -3815,17 +3834,24 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
3815
3834
|
}
|
|
3816
3835
|
return void 0;
|
|
3817
3836
|
}
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3837
|
+
/**
|
|
3838
|
+
* Check whether a shape or its parent is locked.
|
|
3839
|
+
*
|
|
3840
|
+
* @param shape - The shape (or shape id) to check.
|
|
3841
|
+
*
|
|
3842
|
+
* @public
|
|
3843
|
+
*/
|
|
3844
|
+
isShapeOrAncestorLocked(shape) {
|
|
3845
|
+
const _shape = shape && this.getShape(shape);
|
|
3846
|
+
if (_shape === void 0) return false;
|
|
3847
|
+
if (_shape.isLocked) return true;
|
|
3848
|
+
return this.isShapeOrAncestorLocked(this.getShapeParent(_shape));
|
|
3823
3849
|
}
|
|
3824
|
-
|
|
3825
|
-
return
|
|
3850
|
+
getNotVisibleShapes() {
|
|
3851
|
+
return this._notVisibleShapes.get();
|
|
3826
3852
|
}
|
|
3827
3853
|
getCulledShapes() {
|
|
3828
|
-
const notVisibleShapes2 = this.
|
|
3854
|
+
const notVisibleShapes2 = this.getNotVisibleShapes();
|
|
3829
3855
|
const selectedShapeIds = this.getSelectedShapeIds();
|
|
3830
3856
|
const editingId = this.getEditingShapeId();
|
|
3831
3857
|
const culledShapes = new Set(notVisibleShapes2);
|
|
@@ -3970,18 +3996,18 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
3970
3996
|
* @example
|
|
3971
3997
|
* ```ts
|
|
3972
3998
|
* editor.getShapesAtPoint({ x: 100, y: 100 })
|
|
3973
|
-
* editor.getShapesAtPoint({ x: 100, y: 100 }, { hitInside: true,
|
|
3999
|
+
* editor.getShapesAtPoint({ x: 100, y: 100 }, { hitInside: true, margin: 8 })
|
|
3974
4000
|
* ```
|
|
3975
4001
|
*
|
|
3976
4002
|
* @param point - The page point to test.
|
|
3977
4003
|
* @param opts - The options for the hit point testing.
|
|
3978
4004
|
*
|
|
4005
|
+
* @returns An array of shapes at the given point, sorted in reverse order of their absolute z-index (top-most shape first).
|
|
4006
|
+
*
|
|
3979
4007
|
* @public
|
|
3980
4008
|
*/
|
|
3981
4009
|
getShapesAtPoint(point, opts = {}) {
|
|
3982
|
-
return this.
|
|
3983
|
-
(shape) => !this.isShapeHidden(shape) && this.isPointInShape(shape, point, opts)
|
|
3984
|
-
);
|
|
4010
|
+
return this.getCurrentPageShapesSorted().filter((shape) => !this.isShapeHidden(shape) && this.isPointInShape(shape, point, opts)).reverse();
|
|
3985
4011
|
}
|
|
3986
4012
|
/**
|
|
3987
4013
|
* Test whether a point (in the current page space) will will a shape. This method takes into account masks,
|
|
@@ -4631,7 +4657,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
4631
4657
|
*/
|
|
4632
4658
|
duplicateShapes(shapes, offset) {
|
|
4633
4659
|
this.run(() => {
|
|
4634
|
-
const
|
|
4660
|
+
const _ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
|
|
4661
|
+
const ids = this._shouldIgnoreShapeLock ? _ids : this._getUnlockedShapeIds(_ids);
|
|
4635
4662
|
if (ids.length <= 0) return this;
|
|
4636
4663
|
const initialIds = new Set(ids);
|
|
4637
4664
|
const shapeIdSet = this.getShapeAndDescendantIds(ids);
|
|
@@ -5839,6 +5866,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5839
5866
|
...shape.meta
|
|
5840
5867
|
};
|
|
5841
5868
|
});
|
|
5869
|
+
this.emit("created-shapes", shapeRecordsToCreate);
|
|
5870
|
+
this.emit("edit");
|
|
5842
5871
|
this.store.put(shapeRecordsToCreate);
|
|
5843
5872
|
});
|
|
5844
5873
|
return this;
|
|
@@ -6080,6 +6109,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
6080
6109
|
updated = this.getShapeUtil(shape).onBeforeUpdate?.(shape, updated) ?? updated;
|
|
6081
6110
|
updates.push(updated);
|
|
6082
6111
|
}
|
|
6112
|
+
this.emit("edited-shapes", updates);
|
|
6113
|
+
this.emit("edit");
|
|
6083
6114
|
this.store.put(updates);
|
|
6084
6115
|
});
|
|
6085
6116
|
}
|
|
@@ -6101,6 +6132,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
6101
6132
|
allShapeIdsToDelete.add(childId);
|
|
6102
6133
|
});
|
|
6103
6134
|
}
|
|
6135
|
+
this.emit("deleted-shapes", [...allShapeIdsToDelete]);
|
|
6136
|
+
this.emit("edit");
|
|
6104
6137
|
return this.run(() => this.store.remove([...allShapeIdsToDelete]));
|
|
6105
6138
|
}
|
|
6106
6139
|
deleteShape(_id) {
|
|
@@ -6444,6 +6477,14 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
6444
6477
|
async putExternalContent(info) {
|
|
6445
6478
|
return this.externalContentHandlers[info.type]?.(info);
|
|
6446
6479
|
}
|
|
6480
|
+
/**
|
|
6481
|
+
* Handle replacing external content.
|
|
6482
|
+
*
|
|
6483
|
+
* @param info - Info about the external content.
|
|
6484
|
+
*/
|
|
6485
|
+
async replaceExternalContent(info) {
|
|
6486
|
+
return this.externalContentHandlers[info.type]?.(info);
|
|
6487
|
+
}
|
|
6447
6488
|
/**
|
|
6448
6489
|
* Get content that can be exported for the given shape ids.
|
|
6449
6490
|
*
|
|
@@ -7770,7 +7811,7 @@ __decorateElement(_init, 1, "_getShapePageBoundsCache", __getShapePageBoundsCach
|
|
|
7770
7811
|
__decorateElement(_init, 1, "_getShapeClipPathCache", __getShapeClipPathCache_dec, Editor);
|
|
7771
7812
|
__decorateElement(_init, 1, "_getShapeMaskCache", __getShapeMaskCache_dec, Editor);
|
|
7772
7813
|
__decorateElement(_init, 1, "_getShapeMaskedPageBoundsCache", __getShapeMaskedPageBoundsCache_dec, Editor);
|
|
7773
|
-
__decorateElement(_init, 1, "
|
|
7814
|
+
__decorateElement(_init, 1, "getNotVisibleShapes", _getNotVisibleShapes_dec, Editor);
|
|
7774
7815
|
__decorateElement(_init, 1, "getCulledShapes", _getCulledShapes_dec, Editor);
|
|
7775
7816
|
__decorateElement(_init, 1, "getCurrentPageBounds", _getCurrentPageBounds_dec, Editor);
|
|
7776
7817
|
__decorateElement(_init, 1, "getCurrentPageShapes", _getCurrentPageShapes_dec, Editor);
|