@tldraw/editor 5.3.0-canary.26ec89c1864b → 5.3.0-canary.3cf7ba2fcdbb

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.
@@ -1220,6 +1220,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1220
1220
  * @public
1221
1221
  */
1222
1222
  isDisposed: boolean;
1223
+ /**
1224
+ * Whether the editor is mounted.
1225
+ *
1226
+ * @public
1227
+ */
1228
+ isMounted: boolean;
1223
1229
  /* Excluded from this release type: _tickManager */
1224
1230
  /**
1225
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.26ec89c1864b",
382
+ "5.3.0-canary.3cf7ba2fcdbb",
383
383
  "cjs"
384
384
  );
385
385
  //# sourceMappingURL=index.js.map
@@ -492,6 +492,9 @@ class Editor extends import_eventemitter3.default {
492
492
  },
493
493
  instance_page_state: {
494
494
  afterChange: (prev, next) => {
495
+ if (prev?.focusedGroupId !== next?.focusedGroupId) {
496
+ this.cancelDoubleClick();
497
+ }
495
498
  if (prev?.selectedShapeIds !== next?.selectedShapeIds) {
496
499
  const filtered = next.selectedShapeIds.filter((id) => {
497
500
  let parentId = this.getShape(id)?.parentId;
@@ -564,6 +567,9 @@ class Editor extends import_eventemitter3.default {
564
567
  this.stopFollowingUser();
565
568
  }
566
569
  this.on("tick", this._flushEventsForTick);
570
+ this.once("mount", () => {
571
+ this.isMounted = true;
572
+ });
567
573
  this.timers.requestAnimationFrame(() => {
568
574
  this._tickManager.start();
569
575
  });
@@ -658,6 +664,12 @@ class Editor extends import_eventemitter3.default {
658
664
  * @public
659
665
  */
660
666
  isDisposed = false;
667
+ /**
668
+ * Whether the editor is mounted.
669
+ *
670
+ * @public
671
+ */
672
+ isMounted = false;
661
673
  /**
662
674
  * A manager for the editor's tick events.
663
675
  *
@@ -4234,7 +4246,21 @@ class Editor extends import_eventemitter3.default {
4234
4246
  */
4235
4247
  getSelectedShapeAtPoint(point) {
4236
4248
  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 }));
4249
+ const margin = this.options.hitTestMargin / this.getZoomLevel();
4250
+ const sortedShapes = this.getCurrentPageShapesSorted();
4251
+ for (let i = sortedShapes.length - 1; i >= 0; i--) {
4252
+ const shape = sortedShapes[i];
4253
+ if (shape.type === "group") continue;
4254
+ if (!selectedShapeIds.includes(shape.id)) continue;
4255
+ if (this.getShapeGeometry(shape).hitTestPoint(
4256
+ this.getPointInShapeSpace(shape, point),
4257
+ margin,
4258
+ true
4259
+ )) {
4260
+ return shape;
4261
+ }
4262
+ }
4263
+ return void 0;
4238
4264
  }
4239
4265
  /**
4240
4266
  * Get the shape at the current point.