@tldraw/editor 5.3.0-canary.c1b0b7574979 → 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.
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.c1b0b7574979",
382
+ "5.3.0-canary.da7dc7ee3db8",
383
383
  "cjs"
384
384
  );
385
385
  //# sourceMappingURL=index.js.map
@@ -4243,7 +4243,21 @@ class Editor extends import_eventemitter3.default {
4243
4243
  */
4244
4244
  getSelectedShapeAtPoint(point) {
4245
4245
  const selectedShapeIds = this.getSelectedShapeIds();
4246
- 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;
4247
4261
  }
4248
4262
  /**
4249
4263
  * Get the shape at the current point.