@tldraw/editor 3.14.0-canary.33add84014ed → 3.14.0-canary.33ea232f2305

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.
Files changed (58) hide show
  1. package/dist-cjs/index.d.ts +15 -114
  2. package/dist-cjs/index.js +1 -4
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/editor/Editor.js +27 -75
  5. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  6. package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js +1 -3
  7. package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +2 -2
  8. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +2 -3
  9. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
  10. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +10 -0
  11. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  12. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +6 -10
  13. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +3 -3
  14. package/dist-cjs/lib/editor/tools/StateNode.js +3 -3
  15. package/dist-cjs/lib/editor/tools/StateNode.js.map +2 -2
  16. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  17. package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
  18. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +2 -6
  19. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  20. package/dist-cjs/version.js +3 -3
  21. package/dist-cjs/version.js.map +1 -1
  22. package/dist-esm/index.d.mts +15 -114
  23. package/dist-esm/index.mjs +1 -4
  24. package/dist-esm/index.mjs.map +2 -2
  25. package/dist-esm/lib/editor/Editor.mjs +27 -75
  26. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  27. package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs +1 -3
  28. package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +2 -2
  29. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +2 -3
  30. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
  31. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +10 -0
  32. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  33. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +6 -10
  34. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +3 -3
  35. package/dist-esm/lib/editor/tools/StateNode.mjs +3 -3
  36. package/dist-esm/lib/editor/tools/StateNode.mjs.map +2 -2
  37. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +2 -6
  38. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  39. package/dist-esm/version.mjs +3 -3
  40. package/dist-esm/version.mjs.map +1 -1
  41. package/editor.css +11 -10
  42. package/package.json +7 -7
  43. package/src/index.ts +0 -6
  44. package/src/lib/editor/Editor.ts +35 -86
  45. package/src/lib/editor/managers/HistoryManager/HistoryManager.ts +1 -3
  46. package/src/lib/editor/managers/TextManager/TextManager.ts +2 -4
  47. package/src/lib/editor/shapes/ShapeUtil.ts +15 -47
  48. package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +17 -22
  49. package/src/lib/editor/tools/StateNode.ts +3 -3
  50. package/src/lib/editor/types/emit-types.ts +0 -4
  51. package/src/lib/editor/types/external-content.ts +1 -10
  52. package/src/lib/primitives/geometry/Geometry2d.ts +2 -7
  53. package/src/version.ts +3 -3
  54. package/dist-cjs/lib/utils/reparenting.js +0 -232
  55. package/dist-cjs/lib/utils/reparenting.js.map +0 -7
  56. package/dist-esm/lib/utils/reparenting.mjs +0 -216
  57. package/dist-esm/lib/utils/reparenting.mjs.map +0 -7
  58. package/src/lib/utils/reparenting.ts +0 -383
@@ -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, _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) {
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, _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;
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], _getSelectionScreenBounds_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,
@@ -323,7 +323,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
323
323
  __publicField(this, "externalContentHandlers", {
324
324
  text: null,
325
325
  files: null,
326
- "file-replace": null,
327
326
  embed: null,
328
327
  "svg-text": null,
329
328
  url: null,
@@ -1642,12 +1641,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1642
1641
  getSelectionPageBounds() {
1643
1642
  return this.getShapesPageBounds(this.getSelectedShapeIds());
1644
1643
  }
1645
- /**
1646
- * The bounds of the selection bounding box in the current page space.
1647
- *
1648
- * @readonly
1649
- * @public
1650
- */
1651
1644
  getSelectionScreenBounds() {
1652
1645
  const bounds = this.getSelectionPageBounds();
1653
1646
  if (!bounds) return void 0;
@@ -4131,7 +4124,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
4131
4124
  if (!id) return void 0;
4132
4125
  const freshShape = this.getShape(id);
4133
4126
  if (freshShape === void 0 || !(0, import_tlschema.isShapeId)(freshShape.parentId)) return void 0;
4134
- return this.getShape(freshShape.parentId);
4127
+ return this.store.get(freshShape.parentId);
4135
4128
  }
4136
4129
  /**
4137
4130
  * If siblingShape and targetShape are siblings, this returns targetShape. If targetShape has an
@@ -4263,9 +4256,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
4263
4256
  if (!pagePoint) continue;
4264
4257
  const newPoint = invertedParentTransform.applyToPoint(pagePoint);
4265
4258
  const newRotation = pageTransform.rotation() - parentPageRotation;
4266
- if (shape.id === parentId) {
4267
- throw Error("Attempted to reparent a shape to itself!");
4268
- }
4269
4259
  changes.push({
4270
4260
  id: shape.id,
4271
4261
  type: shape.type,
@@ -4358,10 +4348,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
4358
4348
  }
4359
4349
  return shapeIds;
4360
4350
  }
4361
- /** @deprecated Use {@link Editor.getDraggingOverShape} instead */
4362
- getDroppingOverShape(point, droppingShapes) {
4363
- return this.getDraggingOverShape(point, droppingShapes);
4364
- }
4365
4351
  /**
4366
4352
  * Get the shape that some shapes should be dropped on at a given point.
4367
4353
  *
@@ -4372,20 +4358,22 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
4372
4358
  *
4373
4359
  * @public
4374
4360
  */
4375
- getDraggingOverShape(point, droppingShapes) {
4376
- const draggingShapes = (0, import_utils.compact)(droppingShapes.map((s) => this.getShape(s))).filter(
4377
- (s) => !s.isLocked && !this.isShapeHidden(s)
4378
- );
4379
- const maybeDraggingOverShapes = this.getShapesAtPoint(point, {
4380
- hitInside: true,
4381
- margin: 0
4382
- }).filter(
4383
- (s) => !droppingShapes.includes(s) && !s.isLocked && !this.isShapeHidden(s) && !draggingShapes.includes(s)
4384
- );
4385
- for (const maybeDraggingOverShape of maybeDraggingOverShapes) {
4386
- const shapeUtil = this.getShapeUtil(maybeDraggingOverShape);
4387
- if (shapeUtil.onDragShapesOver || shapeUtil.onDragShapesIn || shapeUtil.onDragShapesOut || shapeUtil.onDropShapesOver) {
4388
- return maybeDraggingOverShape;
4361
+ getDroppingOverShape(point, droppingShapes = []) {
4362
+ const currentPageShapesSorted = this.getCurrentPageShapesSorted();
4363
+ for (let i = currentPageShapesSorted.length - 1; i >= 0; i--) {
4364
+ const shape = currentPageShapesSorted[i];
4365
+ if (
4366
+ // ignore hidden shapes
4367
+ this.isShapeHidden(shape) || // don't allow dropping on selected shapes
4368
+ this.getSelectedShapeIds().includes(shape.id) || // only allow shapes that can receive children
4369
+ !this.getShapeUtil(shape).canDropShapes(shape, droppingShapes) || // don't allow dropping a shape on itself or one of it's children
4370
+ droppingShapes.find((s) => s.id === shape.id || this.hasAncestor(shape, s.id))
4371
+ ) {
4372
+ continue;
4373
+ }
4374
+ const maskedPageBounds = this.getShapeMaskedPageBounds(shape.id);
4375
+ if (maskedPageBounds && maskedPageBounds.containsPoint(point) && this.getShapeGeometry(shape).hitTestPoint(this.getPointInShapeSpace(shape, point), 0, true)) {
4376
+ return shape;
4389
4377
  }
4390
4378
  }
4391
4379
  }
@@ -4662,8 +4650,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
4662
4650
  */
4663
4651
  duplicateShapes(shapes, offset) {
4664
4652
  this.run(() => {
4665
- const _ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
4666
- const ids = this._shouldIgnoreShapeLock ? _ids : this._getUnlockedShapeIds(_ids);
4653
+ const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
4667
4654
  if (ids.length <= 0) return this;
4668
4655
  const initialIds = new Set(ids);
4669
4656
  const shapeIdSet = this.getShapeAndDescendantIds(ids);
@@ -4727,7 +4714,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
4727
4714
  shape.index = index;
4728
4715
  });
4729
4716
  const shapesToCreate = shapesToCreateWithOriginals.map(({ shape }) => shape);
4730
- if (!this.canCreateShapes(shapesToCreate)) {
4717
+ const maxShapesReached = shapesToCreate.length + this.getCurrentPageShapeIds().size > this.options.maxShapesPerPage;
4718
+ if (maxShapesReached) {
4731
4719
  alertMaxShapes(this);
4732
4720
  return;
4733
4721
  }
@@ -5742,26 +5730,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5742
5730
  getInitialMetaForShape(_shape) {
5743
5731
  return {};
5744
5732
  }
5745
- /**
5746
- * Get whether the provided shape can be created.
5747
- *
5748
- * @param shape - The shape or shape IDs to check.
5749
- *
5750
- * @public
5751
- */
5752
- canCreateShape(shape) {
5753
- return this.canCreateShapes([shape]);
5754
- }
5755
- /**
5756
- * Get whether the provided shapes can be created.
5757
- *
5758
- * @param shapes - The shapes or shape IDs to create.
5759
- *
5760
- * @public
5761
- */
5762
- canCreateShapes(shapes) {
5763
- return shapes.length + this.getCurrentPageShapeIds().size <= this.options.maxShapesPerPage;
5764
- }
5765
5733
  /**
5766
5734
  * Create a single shape.
5767
5735
  *
@@ -5815,8 +5783,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5815
5783
  let parentId = this.getFocusedGroupId();
5816
5784
  for (let i = currentPageShapesSorted.length - 1; i >= 0; i--) {
5817
5785
  const parent = currentPageShapesSorted[i];
5818
- const util = this.getShapeUtil(parent);
5819
- if (util.canReceiveNewChildrenOfType(parent, partial.type) && !this.isShapeHidden(parent) && this.isPointInShape(
5786
+ if (!this.isShapeHidden(parent) && this.getShapeUtil(parent).canReceiveNewChildrenOfType(parent, partial.type) && this.isPointInShape(
5820
5787
  parent,
5821
5788
  // If no parent is provided, then we can treat the
5822
5789
  // shape's provided x/y as being in the page's space.
@@ -5891,8 +5858,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5891
5858
  ...shape.meta
5892
5859
  };
5893
5860
  });
5894
- this.emit("created-shapes", shapeRecordsToCreate);
5895
- this.emit("edit");
5896
5861
  this.store.put(shapeRecordsToCreate);
5897
5862
  });
5898
5863
  return this;
@@ -6134,8 +6099,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6134
6099
  updated = this.getShapeUtil(shape).onBeforeUpdate?.(shape, updated) ?? updated;
6135
6100
  updates.push(updated);
6136
6101
  }
6137
- this.emit("edited-shapes", updates);
6138
- this.emit("edit");
6139
6102
  this.store.put(updates);
6140
6103
  });
6141
6104
  }
@@ -6157,8 +6120,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6157
6120
  allShapeIdsToDelete.add(childId);
6158
6121
  });
6159
6122
  }
6160
- this.emit("deleted-shapes", [...allShapeIdsToDelete]);
6161
- this.emit("edit");
6162
6123
  return this.run(() => this.store.remove([...allShapeIdsToDelete]));
6163
6124
  }
6164
6125
  deleteShape(_id) {
@@ -6502,14 +6463,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6502
6463
  async putExternalContent(info) {
6503
6464
  return this.externalContentHandlers[info.type]?.(info);
6504
6465
  }
6505
- /**
6506
- * Handle replacing external content.
6507
- *
6508
- * @param info - Info about the external content.
6509
- */
6510
- async replaceExternalContent(info) {
6511
- return this.externalContentHandlers[info.type]?.(info);
6512
- }
6513
6466
  /**
6514
6467
  * Get content that can be exported for the given shape ids.
6515
6468
  *
@@ -6927,9 +6880,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6927
6880
  previousScreenPoint,
6928
6881
  previousPagePoint,
6929
6882
  currentScreenPoint,
6930
- currentPagePoint,
6931
- originScreenPoint,
6932
- originPagePoint
6883
+ currentPagePoint
6933
6884
  } = this.inputs;
6934
6885
  const { screenBounds } = this.store.unsafeGetWithoutCapture(import_tlschema.TLINSTANCE_ID);
6935
6886
  const { x: cx, y: cy, z: cz } = (0, import_state.unsafe__withoutCapture)(() => this.getCamera());
@@ -6947,8 +6898,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6947
6898
  this.inputs.isPen = info.type === "pointer" && info.isPen;
6948
6899
  if (info.name === "pointer_down" || this.inputs.isPinching) {
6949
6900
  pointerVelocity.set(0, 0);
6950
- originScreenPoint.setTo(currentScreenPoint);
6951
- originPagePoint.setTo(currentPagePoint);
6901
+ this.inputs.originScreenPoint.setTo(currentScreenPoint);
6902
+ this.inputs.originPagePoint.setTo(currentPagePoint);
6952
6903
  }
6953
6904
  this.run(
6954
6905
  () => {
@@ -7801,6 +7752,7 @@ __decorateElement(_init, 1, "getCurrentPageShapesInReadingOrder", _getCurrentPag
7801
7752
  __decorateElement(_init, 1, "getOnlySelectedShapeId", _getOnlySelectedShapeId_dec, Editor);
7802
7753
  __decorateElement(_init, 1, "getOnlySelectedShape", _getOnlySelectedShape_dec, Editor);
7803
7754
  __decorateElement(_init, 1, "getSelectionPageBounds", _getSelectionPageBounds_dec, Editor);
7755
+ __decorateElement(_init, 1, "getSelectionScreenBounds", _getSelectionScreenBounds_dec, Editor);
7804
7756
  __decorateElement(_init, 1, "getSelectionRotation", _getSelectionRotation_dec, Editor);
7805
7757
  __decorateElement(_init, 1, "getSelectionRotatedPageBounds", _getSelectionRotatedPageBounds_dec, Editor);
7806
7758
  __decorateElement(_init, 1, "getSelectionRotatedScreenBounds", _getSelectionRotatedScreenBounds_dec, Editor);