@tldraw/editor 5.4.0-next.b120f7febb0f → 5.4.0-next.ebc95cf01337
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 +47 -46
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +17 -14
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js +7 -3
- package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Group2d.js +63 -21
- package/dist-cjs/lib/primitives/geometry/Group2d.js.map +2 -2
- package/dist-cjs/lib/utils/normalizeWheel.js +2 -0
- package/dist-cjs/lib/utils/normalizeWheel.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 +47 -46
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +17 -14
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs +7 -3
- package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Group2d.mjs +63 -21
- package/dist-esm/lib/primitives/geometry/Group2d.mjs.map +2 -2
- package/dist-esm/lib/utils/normalizeWheel.mjs +2 -0
- package/dist-esm/lib/utils/normalizeWheel.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/editor/Editor.ts +25 -24
- package/src/lib/editor/derivations/shapeIdsInCurrentPage.ts +7 -3
- package/src/lib/primitives/geometry/Group2d.ts +63 -27
- package/src/lib/utils/normalizeWheel.test.ts +39 -0
- package/src/lib/utils/normalizeWheel.ts +6 -0
- package/src/version.ts +3 -3
package/dist-esm/index.mjs
CHANGED
|
@@ -305,7 +305,7 @@ import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
|
|
|
305
305
|
import { uniq } from "./lib/utils/uniq.mjs";
|
|
306
306
|
registerTldrawLibraryVersion(
|
|
307
307
|
"@tldraw/editor",
|
|
308
|
-
"5.4.0-next.
|
|
308
|
+
"5.4.0-next.ebc95cf01337",
|
|
309
309
|
"esm"
|
|
310
310
|
);
|
|
311
311
|
import { getColorValue } from "./lib/editor/managers/ThemeManager/defaultThemes.mjs";
|
|
@@ -4331,17 +4331,16 @@ class Editor extends EventEmitter {
|
|
|
4331
4331
|
let inMarginClosestToEdgeHit = null;
|
|
4332
4332
|
const searchMargin = Math.max(innerMargin, outerMargin, this.getHitTestMargin());
|
|
4333
4333
|
const candidateIds = this._spatialIndex.getShapeIdsAtPoint(point, searchMargin);
|
|
4334
|
-
const shapesToCheck =
|
|
4335
|
-
if (!candidateIds.has(shape.id) && !this.isShapeFrameLike(shape)) return false;
|
|
4336
|
-
if (shape.isLocked && !hitLocked || this.isShapeHidden(shape) || this.isShapeOfType(shape, "group"))
|
|
4337
|
-
return false;
|
|
4338
|
-
const pageMask = this.getShapeMask(shape);
|
|
4339
|
-
if (pageMask && !pointInPolygon(point, pageMask)) return false;
|
|
4340
|
-
if (filter && !filter(shape)) return false;
|
|
4341
|
-
return true;
|
|
4342
|
-
});
|
|
4334
|
+
const shapesToCheck = opts.renderingOnly ? this.getCurrentPageRenderingShapesSorted() : this.getCurrentPageShapesSorted();
|
|
4343
4335
|
for (let i = shapesToCheck.length - 1; i >= 0; i--) {
|
|
4344
4336
|
const shape = shapesToCheck[i];
|
|
4337
|
+
if (!candidateIds.has(shape.id) && !this.isShapeFrameLike(shape)) continue;
|
|
4338
|
+
if (shape.isLocked && !hitLocked || this.isShapeHidden(shape) || this.isShapeOfType(shape, "group")) {
|
|
4339
|
+
continue;
|
|
4340
|
+
}
|
|
4341
|
+
const pageMask = this.getShapeMask(shape);
|
|
4342
|
+
if (pageMask && !pointInPolygon(point, pageMask)) continue;
|
|
4343
|
+
if (filter && !filter(shape)) continue;
|
|
4345
4344
|
const geometry = this.getShapeGeometry(shape);
|
|
4346
4345
|
const isGroup = geometry instanceof Group2d;
|
|
4347
4346
|
const pointInShapeSpace = this.getPointInShapeSpace(shape, point);
|
|
@@ -4446,11 +4445,15 @@ class Editor extends EventEmitter {
|
|
|
4446
4445
|
getShapesAtPoint(point, opts = {}) {
|
|
4447
4446
|
const margin = opts.margin ?? 0;
|
|
4448
4447
|
const candidateIds = this._spatialIndex.getShapeIdsAtPoint(point, margin);
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4448
|
+
const sorted = this.getCurrentPageShapesSorted();
|
|
4449
|
+
const result = [];
|
|
4450
|
+
for (let i = sorted.length - 1; i >= 0; i--) {
|
|
4451
|
+
const shape = sorted[i];
|
|
4452
|
+
if (this.isShapeHidden(shape)) continue;
|
|
4453
|
+
if (!candidateIds.has(shape.id) && !this.isShapeFrameLike(shape)) continue;
|
|
4454
|
+
if (this.isPointInShape(shape, point, opts)) result.push(shape);
|
|
4455
|
+
}
|
|
4456
|
+
return result;
|
|
4454
4457
|
}
|
|
4455
4458
|
/**
|
|
4456
4459
|
* Get shape IDs within the given bounds.
|