@tldraw/editor 3.14.0-canary.9fbe607cbc54 → 3.14.0-canary.a44859ffd3c7
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 +15 -114
- package/dist-cjs/index.js +1 -4
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +27 -75
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js +1 -3
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +2 -3
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +10 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +6 -10
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +3 -3
- 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/primitives/geometry/Geometry2d.js +2 -6
- package/dist-cjs/lib/primitives/geometry/Geometry2d.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 +15 -114
- package/dist-esm/index.mjs +1 -4
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +27 -75
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs +1 -3
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +2 -3
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +10 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +6 -10
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +3 -3
- 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/primitives/geometry/Geometry2d.mjs +2 -6
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +11 -10
- package/package.json +7 -7
- package/src/index.ts +0 -6
- package/src/lib/editor/Editor.ts +35 -86
- package/src/lib/editor/managers/HistoryManager/HistoryManager.ts +1 -3
- package/src/lib/editor/managers/TextManager/TextManager.ts +2 -4
- package/src/lib/editor/shapes/ShapeUtil.ts +15 -47
- package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +17 -22
- package/src/lib/editor/tools/StateNode.ts +3 -3
- package/src/lib/editor/types/emit-types.ts +0 -4
- package/src/lib/editor/types/external-content.ts +1 -10
- package/src/lib/primitives/geometry/Geometry2d.ts +2 -7
- package/src/version.ts +3 -3
- package/dist-cjs/lib/utils/reparenting.js +0 -232
- package/dist-cjs/lib/utils/reparenting.js.map +0 -7
- package/dist-esm/lib/utils/reparenting.mjs +0 -216
- package/dist-esm/lib/utils/reparenting.mjs.map +0 -7
- package/src/lib/utils/reparenting.ts +0 -383
|
@@ -46,7 +46,7 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
|
|
|
46
46
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
47
47
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
48
48
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
49
|
-
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;
|
|
49
|
+
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, _getSelectionScreenBounds_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;
|
|
50
50
|
import {
|
|
51
51
|
EMPTY_ARRAY,
|
|
52
52
|
atom,
|
|
@@ -158,7 +158,7 @@ import { TextManager } from "./managers/TextManager/TextManager.mjs";
|
|
|
158
158
|
import { TickManager } from "./managers/TickManager/TickManager.mjs";
|
|
159
159
|
import { UserPreferencesManager } from "./managers/UserPreferencesManager/UserPreferencesManager.mjs";
|
|
160
160
|
import { RootState } from "./tools/RootState.mjs";
|
|
161
|
-
class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed], _getCanUndo_dec = [computed], _getCanRedo_dec = [computed], _getPath_dec = [computed], _getCurrentTool_dec = [computed], _getCurrentToolId_dec = [computed], _getDocumentSettings_dec = [computed], _getInstanceState_dec = [computed], _getOpenMenus_dec = [computed], _getIsMenuOpen_dec = [computed], _getPageStates_dec = [computed], __getPageStatesQuery_dec = [computed], _getCurrentPageState_dec = [computed], __getCurrentPageStateId_dec = [computed], _getSelectedShapeIds_dec = [computed], _getSelectedShapes_dec = [computed], _getCurrentPageShapesInReadingOrder_dec = [computed], _getOnlySelectedShapeId_dec = [computed], _getOnlySelectedShape_dec = [computed], _getSelectionPageBounds_dec = [computed], _getSelectionRotation_dec = [computed], _getSelectionRotatedPageBounds_dec = [computed], _getSelectionRotatedScreenBounds_dec = [computed], _getFocusedGroupId_dec = [computed], _getFocusedGroup_dec = [computed], _getEditingShapeId_dec = [computed], _getEditingShape_dec = [computed], _getRichTextEditor_dec = [computed], _getHoveredShapeId_dec = [computed], _getHoveredShape_dec = [computed], _getHintingShapeIds_dec = [computed], _getHintingShape_dec = [computed], _getErasingShapeIds_dec = [computed], _getErasingShapes_dec = [computed], __unsafe_getCameraId_dec = [computed], _getCamera_dec = [computed], _getViewportPageBoundsForFollowing_dec = [computed], _getCameraForFollowing_dec = [computed], _getZoomLevel_dec = [computed], _getViewportScreenBounds_dec = [computed], _getViewportScreenCenter_dec = [computed], _getViewportPageBounds_dec = [computed], __getCollaboratorsQuery_dec = [computed], _getCollaborators_dec = [computed], _getCollaboratorsOnCurrentPage_dec = [computed], _getRenderingShapes_dec = [computed], __getAllPagesQuery_dec = [computed], _getPages_dec = [computed], _getCurrentPageId_dec = [computed], _getCurrentPageShapeIdsSorted_dec = [computed], __getAllAssetsQuery_dec = [computed], __getShapeHandlesCache_dec = [computed], __getShapePageTransformCache_dec = [computed], __getShapePageBoundsCache_dec = [computed], __getShapeClipPathCache_dec = [computed], __getShapeMaskCache_dec = [computed], __getShapeMaskedPageBoundsCache_dec = [computed], _getNotVisibleShapes_dec = [computed], _getCulledShapes_dec = [computed], _getCurrentPageBounds_dec = [computed], _getCurrentPageShapes_dec = [computed], _getCurrentPageShapesSorted_dec = [computed], _getCurrentPageRenderingShapesSorted_dec = [computed], __getBindingsIndexCache_dec = [computed], __getSelectionSharedStyles_dec = [computed], _getSharedStyles_dec = [computed({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [computed], _getIsFocused_dec = [computed], _getIsReadonly_dec = [computed], __setShiftKeyTimeout_dec = [bind], __setAltKeyTimeout_dec = [bind], __setCtrlKeyTimeout_dec = [bind], __setMetaKeyTimeout_dec = [bind], _a) {
|
|
161
|
+
class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed], _getCanUndo_dec = [computed], _getCanRedo_dec = [computed], _getPath_dec = [computed], _getCurrentTool_dec = [computed], _getCurrentToolId_dec = [computed], _getDocumentSettings_dec = [computed], _getInstanceState_dec = [computed], _getOpenMenus_dec = [computed], _getIsMenuOpen_dec = [computed], _getPageStates_dec = [computed], __getPageStatesQuery_dec = [computed], _getCurrentPageState_dec = [computed], __getCurrentPageStateId_dec = [computed], _getSelectedShapeIds_dec = [computed], _getSelectedShapes_dec = [computed], _getCurrentPageShapesInReadingOrder_dec = [computed], _getOnlySelectedShapeId_dec = [computed], _getOnlySelectedShape_dec = [computed], _getSelectionPageBounds_dec = [computed], _getSelectionScreenBounds_dec = [computed], _getSelectionRotation_dec = [computed], _getSelectionRotatedPageBounds_dec = [computed], _getSelectionRotatedScreenBounds_dec = [computed], _getFocusedGroupId_dec = [computed], _getFocusedGroup_dec = [computed], _getEditingShapeId_dec = [computed], _getEditingShape_dec = [computed], _getRichTextEditor_dec = [computed], _getHoveredShapeId_dec = [computed], _getHoveredShape_dec = [computed], _getHintingShapeIds_dec = [computed], _getHintingShape_dec = [computed], _getErasingShapeIds_dec = [computed], _getErasingShapes_dec = [computed], __unsafe_getCameraId_dec = [computed], _getCamera_dec = [computed], _getViewportPageBoundsForFollowing_dec = [computed], _getCameraForFollowing_dec = [computed], _getZoomLevel_dec = [computed], _getViewportScreenBounds_dec = [computed], _getViewportScreenCenter_dec = [computed], _getViewportPageBounds_dec = [computed], __getCollaboratorsQuery_dec = [computed], _getCollaborators_dec = [computed], _getCollaboratorsOnCurrentPage_dec = [computed], _getRenderingShapes_dec = [computed], __getAllPagesQuery_dec = [computed], _getPages_dec = [computed], _getCurrentPageId_dec = [computed], _getCurrentPageShapeIdsSorted_dec = [computed], __getAllAssetsQuery_dec = [computed], __getShapeHandlesCache_dec = [computed], __getShapePageTransformCache_dec = [computed], __getShapePageBoundsCache_dec = [computed], __getShapeClipPathCache_dec = [computed], __getShapeMaskCache_dec = [computed], __getShapeMaskedPageBoundsCache_dec = [computed], _getNotVisibleShapes_dec = [computed], _getCulledShapes_dec = [computed], _getCurrentPageBounds_dec = [computed], _getCurrentPageShapes_dec = [computed], _getCurrentPageShapesSorted_dec = [computed], _getCurrentPageRenderingShapesSorted_dec = [computed], __getBindingsIndexCache_dec = [computed], __getSelectionSharedStyles_dec = [computed], _getSharedStyles_dec = [computed({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [computed], _getIsFocused_dec = [computed], _getIsReadonly_dec = [computed], __setShiftKeyTimeout_dec = [bind], __setAltKeyTimeout_dec = [bind], __setCtrlKeyTimeout_dec = [bind], __setMetaKeyTimeout_dec = [bind], _a) {
|
|
162
162
|
constructor({
|
|
163
163
|
store,
|
|
164
164
|
user,
|
|
@@ -357,7 +357,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
357
357
|
__publicField(this, "externalContentHandlers", {
|
|
358
358
|
text: null,
|
|
359
359
|
files: null,
|
|
360
|
-
"file-replace": null,
|
|
361
360
|
embed: null,
|
|
362
361
|
"svg-text": null,
|
|
363
362
|
url: null,
|
|
@@ -1676,12 +1675,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
1676
1675
|
getSelectionPageBounds() {
|
|
1677
1676
|
return this.getShapesPageBounds(this.getSelectedShapeIds());
|
|
1678
1677
|
}
|
|
1679
|
-
/**
|
|
1680
|
-
* The bounds of the selection bounding box in the current page space.
|
|
1681
|
-
*
|
|
1682
|
-
* @readonly
|
|
1683
|
-
* @public
|
|
1684
|
-
*/
|
|
1685
1678
|
getSelectionScreenBounds() {
|
|
1686
1679
|
const bounds = this.getSelectionPageBounds();
|
|
1687
1680
|
if (!bounds) return void 0;
|
|
@@ -4165,7 +4158,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
4165
4158
|
if (!id) return void 0;
|
|
4166
4159
|
const freshShape = this.getShape(id);
|
|
4167
4160
|
if (freshShape === void 0 || !isShapeId(freshShape.parentId)) return void 0;
|
|
4168
|
-
return this.
|
|
4161
|
+
return this.store.get(freshShape.parentId);
|
|
4169
4162
|
}
|
|
4170
4163
|
/**
|
|
4171
4164
|
* If siblingShape and targetShape are siblings, this returns targetShape. If targetShape has an
|
|
@@ -4297,9 +4290,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
4297
4290
|
if (!pagePoint) continue;
|
|
4298
4291
|
const newPoint = invertedParentTransform.applyToPoint(pagePoint);
|
|
4299
4292
|
const newRotation = pageTransform.rotation() - parentPageRotation;
|
|
4300
|
-
if (shape.id === parentId) {
|
|
4301
|
-
throw Error("Attempted to reparent a shape to itself!");
|
|
4302
|
-
}
|
|
4303
4293
|
changes.push({
|
|
4304
4294
|
id: shape.id,
|
|
4305
4295
|
type: shape.type,
|
|
@@ -4392,10 +4382,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
4392
4382
|
}
|
|
4393
4383
|
return shapeIds;
|
|
4394
4384
|
}
|
|
4395
|
-
/** @deprecated Use {@link Editor.getDraggingOverShape} instead */
|
|
4396
|
-
getDroppingOverShape(point, droppingShapes) {
|
|
4397
|
-
return this.getDraggingOverShape(point, droppingShapes);
|
|
4398
|
-
}
|
|
4399
4385
|
/**
|
|
4400
4386
|
* Get the shape that some shapes should be dropped on at a given point.
|
|
4401
4387
|
*
|
|
@@ -4406,20 +4392,22 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
4406
4392
|
*
|
|
4407
4393
|
* @public
|
|
4408
4394
|
*/
|
|
4409
|
-
|
|
4410
|
-
const
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4395
|
+
getDroppingOverShape(point, droppingShapes = []) {
|
|
4396
|
+
const currentPageShapesSorted = this.getCurrentPageShapesSorted();
|
|
4397
|
+
for (let i = currentPageShapesSorted.length - 1; i >= 0; i--) {
|
|
4398
|
+
const shape = currentPageShapesSorted[i];
|
|
4399
|
+
if (
|
|
4400
|
+
// ignore hidden shapes
|
|
4401
|
+
this.isShapeHidden(shape) || // don't allow dropping on selected shapes
|
|
4402
|
+
this.getSelectedShapeIds().includes(shape.id) || // only allow shapes that can receive children
|
|
4403
|
+
!this.getShapeUtil(shape).canDropShapes(shape, droppingShapes) || // don't allow dropping a shape on itself or one of it's children
|
|
4404
|
+
droppingShapes.find((s) => s.id === shape.id || this.hasAncestor(shape, s.id))
|
|
4405
|
+
) {
|
|
4406
|
+
continue;
|
|
4407
|
+
}
|
|
4408
|
+
const maskedPageBounds = this.getShapeMaskedPageBounds(shape.id);
|
|
4409
|
+
if (maskedPageBounds && maskedPageBounds.containsPoint(point) && this.getShapeGeometry(shape).hitTestPoint(this.getPointInShapeSpace(shape, point), 0, true)) {
|
|
4410
|
+
return shape;
|
|
4423
4411
|
}
|
|
4424
4412
|
}
|
|
4425
4413
|
}
|
|
@@ -4696,8 +4684,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
4696
4684
|
*/
|
|
4697
4685
|
duplicateShapes(shapes, offset) {
|
|
4698
4686
|
this.run(() => {
|
|
4699
|
-
const
|
|
4700
|
-
const ids = this._shouldIgnoreShapeLock ? _ids : this._getUnlockedShapeIds(_ids);
|
|
4687
|
+
const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
|
|
4701
4688
|
if (ids.length <= 0) return this;
|
|
4702
4689
|
const initialIds = new Set(ids);
|
|
4703
4690
|
const shapeIdSet = this.getShapeAndDescendantIds(ids);
|
|
@@ -4761,7 +4748,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
4761
4748
|
shape.index = index;
|
|
4762
4749
|
});
|
|
4763
4750
|
const shapesToCreate = shapesToCreateWithOriginals.map(({ shape }) => shape);
|
|
4764
|
-
|
|
4751
|
+
const maxShapesReached = shapesToCreate.length + this.getCurrentPageShapeIds().size > this.options.maxShapesPerPage;
|
|
4752
|
+
if (maxShapesReached) {
|
|
4765
4753
|
alertMaxShapes(this);
|
|
4766
4754
|
return;
|
|
4767
4755
|
}
|
|
@@ -5776,26 +5764,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
5776
5764
|
getInitialMetaForShape(_shape) {
|
|
5777
5765
|
return {};
|
|
5778
5766
|
}
|
|
5779
|
-
/**
|
|
5780
|
-
* Get whether the provided shape can be created.
|
|
5781
|
-
*
|
|
5782
|
-
* @param shape - The shape or shape IDs to check.
|
|
5783
|
-
*
|
|
5784
|
-
* @public
|
|
5785
|
-
*/
|
|
5786
|
-
canCreateShape(shape) {
|
|
5787
|
-
return this.canCreateShapes([shape]);
|
|
5788
|
-
}
|
|
5789
|
-
/**
|
|
5790
|
-
* Get whether the provided shapes can be created.
|
|
5791
|
-
*
|
|
5792
|
-
* @param shapes - The shapes or shape IDs to create.
|
|
5793
|
-
*
|
|
5794
|
-
* @public
|
|
5795
|
-
*/
|
|
5796
|
-
canCreateShapes(shapes) {
|
|
5797
|
-
return shapes.length + this.getCurrentPageShapeIds().size <= this.options.maxShapesPerPage;
|
|
5798
|
-
}
|
|
5799
5767
|
/**
|
|
5800
5768
|
* Create a single shape.
|
|
5801
5769
|
*
|
|
@@ -5849,8 +5817,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
5849
5817
|
let parentId = this.getFocusedGroupId();
|
|
5850
5818
|
for (let i = currentPageShapesSorted.length - 1; i >= 0; i--) {
|
|
5851
5819
|
const parent = currentPageShapesSorted[i];
|
|
5852
|
-
|
|
5853
|
-
if (util.canReceiveNewChildrenOfType(parent, partial.type) && !this.isShapeHidden(parent) && this.isPointInShape(
|
|
5820
|
+
if (!this.isShapeHidden(parent) && this.getShapeUtil(parent).canReceiveNewChildrenOfType(parent, partial.type) && this.isPointInShape(
|
|
5854
5821
|
parent,
|
|
5855
5822
|
// If no parent is provided, then we can treat the
|
|
5856
5823
|
// shape's provided x/y as being in the page's space.
|
|
@@ -5925,8 +5892,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
5925
5892
|
...shape.meta
|
|
5926
5893
|
};
|
|
5927
5894
|
});
|
|
5928
|
-
this.emit("created-shapes", shapeRecordsToCreate);
|
|
5929
|
-
this.emit("edit");
|
|
5930
5895
|
this.store.put(shapeRecordsToCreate);
|
|
5931
5896
|
});
|
|
5932
5897
|
return this;
|
|
@@ -6168,8 +6133,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
6168
6133
|
updated = this.getShapeUtil(shape).onBeforeUpdate?.(shape, updated) ?? updated;
|
|
6169
6134
|
updates.push(updated);
|
|
6170
6135
|
}
|
|
6171
|
-
this.emit("edited-shapes", updates);
|
|
6172
|
-
this.emit("edit");
|
|
6173
6136
|
this.store.put(updates);
|
|
6174
6137
|
});
|
|
6175
6138
|
}
|
|
@@ -6191,8 +6154,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
6191
6154
|
allShapeIdsToDelete.add(childId);
|
|
6192
6155
|
});
|
|
6193
6156
|
}
|
|
6194
|
-
this.emit("deleted-shapes", [...allShapeIdsToDelete]);
|
|
6195
|
-
this.emit("edit");
|
|
6196
6157
|
return this.run(() => this.store.remove([...allShapeIdsToDelete]));
|
|
6197
6158
|
}
|
|
6198
6159
|
deleteShape(_id) {
|
|
@@ -6536,14 +6497,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
6536
6497
|
async putExternalContent(info) {
|
|
6537
6498
|
return this.externalContentHandlers[info.type]?.(info);
|
|
6538
6499
|
}
|
|
6539
|
-
/**
|
|
6540
|
-
* Handle replacing external content.
|
|
6541
|
-
*
|
|
6542
|
-
* @param info - Info about the external content.
|
|
6543
|
-
*/
|
|
6544
|
-
async replaceExternalContent(info) {
|
|
6545
|
-
return this.externalContentHandlers[info.type]?.(info);
|
|
6546
|
-
}
|
|
6547
6500
|
/**
|
|
6548
6501
|
* Get content that can be exported for the given shape ids.
|
|
6549
6502
|
*
|
|
@@ -6961,9 +6914,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
6961
6914
|
previousScreenPoint,
|
|
6962
6915
|
previousPagePoint,
|
|
6963
6916
|
currentScreenPoint,
|
|
6964
|
-
currentPagePoint
|
|
6965
|
-
originScreenPoint,
|
|
6966
|
-
originPagePoint
|
|
6917
|
+
currentPagePoint
|
|
6967
6918
|
} = this.inputs;
|
|
6968
6919
|
const { screenBounds } = this.store.unsafeGetWithoutCapture(TLINSTANCE_ID);
|
|
6969
6920
|
const { x: cx, y: cy, z: cz } = unsafe__withoutCapture(() => this.getCamera());
|
|
@@ -6981,8 +6932,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
6981
6932
|
this.inputs.isPen = info.type === "pointer" && info.isPen;
|
|
6982
6933
|
if (info.name === "pointer_down" || this.inputs.isPinching) {
|
|
6983
6934
|
pointerVelocity.set(0, 0);
|
|
6984
|
-
originScreenPoint.setTo(currentScreenPoint);
|
|
6985
|
-
originPagePoint.setTo(currentPagePoint);
|
|
6935
|
+
this.inputs.originScreenPoint.setTo(currentScreenPoint);
|
|
6936
|
+
this.inputs.originPagePoint.setTo(currentPagePoint);
|
|
6986
6937
|
}
|
|
6987
6938
|
this.run(
|
|
6988
6939
|
() => {
|
|
@@ -7835,6 +7786,7 @@ __decorateElement(_init, 1, "getCurrentPageShapesInReadingOrder", _getCurrentPag
|
|
|
7835
7786
|
__decorateElement(_init, 1, "getOnlySelectedShapeId", _getOnlySelectedShapeId_dec, Editor);
|
|
7836
7787
|
__decorateElement(_init, 1, "getOnlySelectedShape", _getOnlySelectedShape_dec, Editor);
|
|
7837
7788
|
__decorateElement(_init, 1, "getSelectionPageBounds", _getSelectionPageBounds_dec, Editor);
|
|
7789
|
+
__decorateElement(_init, 1, "getSelectionScreenBounds", _getSelectionScreenBounds_dec, Editor);
|
|
7838
7790
|
__decorateElement(_init, 1, "getSelectionRotation", _getSelectionRotation_dec, Editor);
|
|
7839
7791
|
__decorateElement(_init, 1, "getSelectionRotatedPageBounds", _getSelectionRotatedPageBounds_dec, Editor);
|
|
7840
7792
|
__decorateElement(_init, 1, "getSelectionRotatedScreenBounds", _getSelectionRotatedScreenBounds_dec, Editor);
|