@tldraw/editor 5.3.0-canary.c8a2902d19e5 → 5.3.0-canary.da7dc7ee3db8

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.
@@ -219,7 +219,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
219
219
  }
220
220
 
221
221
  /**
222
- * A base class for frame-like shapes — containers that clip their children,
222
+ * A base class for frame-like shapes — containers that clip their children except arrows,
223
223
  * require full-brush selection, block erasure from inside, and support
224
224
  * drag-and-drop reparenting.
225
225
  *
@@ -231,6 +231,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
231
231
  * - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
232
232
  * - `canRemoveChildrenOfType()` returns `true` unless the container is locked
233
233
  * - `getClipPath()` returns the shape geometry's vertices
234
+ * - `shouldClipChild()` clips all children except arrows
234
235
  * - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
235
236
  * - `onDragShapesOut()` reparents shapes back to the page
236
237
  *
@@ -266,6 +267,7 @@ export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShap
266
267
  canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
267
268
  canRemoveChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
268
269
  getClipPath(shape: Shape): undefined | Vec[];
270
+ shouldClipChild(child: TLShape): boolean;
269
271
  onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
270
272
  onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
271
273
  }
@@ -1218,6 +1220,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1218
1220
  * @public
1219
1221
  */
1220
1222
  isDisposed: boolean;
1223
+ /**
1224
+ * Whether the editor is mounted.
1225
+ *
1226
+ * @public
1227
+ */
1228
+ isMounted: boolean;
1221
1229
  /* Excluded from this release type: _tickManager */
1222
1230
  /**
1223
1231
  * A manager for the editor's input state.
package/dist-cjs/index.js CHANGED
@@ -379,7 +379,7 @@ var import_uniq = require("./lib/utils/uniq");
379
379
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
380
380
  (0, import_utils.registerTldrawLibraryVersion)(
381
381
  "@tldraw/editor",
382
- "5.3.0-canary.c8a2902d19e5",
382
+ "5.3.0-canary.da7dc7ee3db8",
383
383
  "cjs"
384
384
  );
385
385
  //# sourceMappingURL=index.js.map
@@ -564,6 +564,9 @@ class Editor extends import_eventemitter3.default {
564
564
  this.stopFollowingUser();
565
565
  }
566
566
  this.on("tick", this._flushEventsForTick);
567
+ this.once("mount", () => {
568
+ this.isMounted = true;
569
+ });
567
570
  this.timers.requestAnimationFrame(() => {
568
571
  this._tickManager.start();
569
572
  });
@@ -658,6 +661,12 @@ class Editor extends import_eventemitter3.default {
658
661
  * @public
659
662
  */
660
663
  isDisposed = false;
664
+ /**
665
+ * Whether the editor is mounted.
666
+ *
667
+ * @public
668
+ */
669
+ isMounted = false;
661
670
  /**
662
671
  * A manager for the editor's tick events.
663
672
  *
@@ -4234,7 +4243,21 @@ class Editor extends import_eventemitter3.default {
4234
4243
  */
4235
4244
  getSelectedShapeAtPoint(point) {
4236
4245
  const selectedShapeIds = this.getSelectedShapeIds();
4237
- return this.getCurrentPageShapesSorted().filter((shape) => shape.type !== "group" && selectedShapeIds.includes(shape.id)).reverse().find((shape) => this.isPointInShape(shape, point, { hitInside: true, margin: 0 }));
4246
+ const margin = this.options.hitTestMargin / this.getZoomLevel();
4247
+ const sortedShapes = this.getCurrentPageShapesSorted();
4248
+ for (let i = sortedShapes.length - 1; i >= 0; i--) {
4249
+ const shape = sortedShapes[i];
4250
+ if (shape.type === "group") continue;
4251
+ if (!selectedShapeIds.includes(shape.id)) continue;
4252
+ if (this.getShapeGeometry(shape).hitTestPoint(
4253
+ this.getPointInShapeSpace(shape, point),
4254
+ margin,
4255
+ true
4256
+ )) {
4257
+ return shape;
4258
+ }
4259
+ }
4260
+ return void 0;
4238
4261
  }
4239
4262
  /**
4240
4263
  * Get the shape at the current point.