@tldraw/editor 5.3.0-canary.263f9dbe88bb → 5.3.0-canary.7d00ddf70f63
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 +1 -1
- package/dist-cjs/lib/editor/Editor.js +10 -0
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/RBushIndex.js +18 -29
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/RBushIndex.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +96 -54
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +10 -0
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SpatialIndexManager/RBushIndex.mjs +18 -29
- package/dist-esm/lib/editor/managers/SpatialIndexManager/RBushIndex.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +103 -56
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.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 +11 -0
- package/src/lib/editor/managers/SpatialIndexManager/RBushIndex.ts +19 -33
- package/src/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.ts +173 -86
- package/src/version.ts +3 -3
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.
|
|
382
|
+
"5.3.0-canary.7d00ddf70f63",
|
|
383
383
|
"cjs"
|
|
384
384
|
);
|
|
385
385
|
//# sourceMappingURL=index.js.map
|
|
@@ -273,12 +273,16 @@ class Editor extends import_eventemitter3.default {
|
|
|
273
273
|
let deletedBindings = /* @__PURE__ */ new Map();
|
|
274
274
|
const deletedShapeIds = /* @__PURE__ */ new Set();
|
|
275
275
|
const invalidParents = /* @__PURE__ */ new Set();
|
|
276
|
+
const createdShapes = /* @__PURE__ */ new Set();
|
|
276
277
|
let invalidBindingTypes = /* @__PURE__ */ new Set();
|
|
277
278
|
this.disposables.add(
|
|
278
279
|
this.sideEffects.registerOperationCompleteHandler(() => {
|
|
279
280
|
deletedShapeIds.clear();
|
|
281
|
+
const justCreatedShapeIds = new Set(createdShapes);
|
|
282
|
+
createdShapes.clear();
|
|
280
283
|
for (const parentId of invalidParents) {
|
|
281
284
|
invalidParents.delete(parentId);
|
|
285
|
+
if (justCreatedShapeIds.has(parentId)) continue;
|
|
282
286
|
const parent = this.getShape(parentId);
|
|
283
287
|
if (!parent) continue;
|
|
284
288
|
const util = this.getShapeUtil(parent);
|
|
@@ -308,6 +312,12 @@ class Editor extends import_eventemitter3.default {
|
|
|
308
312
|
this.disposables.add(
|
|
309
313
|
this.sideEffects.register({
|
|
310
314
|
shape: {
|
|
315
|
+
afterCreate: (shape) => {
|
|
316
|
+
createdShapes.add(shape.id);
|
|
317
|
+
if (shape.parentId && (0, import_tlschema.isShapeId)(shape.parentId)) {
|
|
318
|
+
invalidParents.add(shape.parentId);
|
|
319
|
+
}
|
|
320
|
+
},
|
|
311
321
|
afterChange: (shapeBefore, shapeAfter) => {
|
|
312
322
|
for (const binding of this.getBindingsInvolvingShape(shapeAfter)) {
|
|
313
323
|
invalidBindingTypes.add(binding.type);
|