@tldraw/editor 4.3.0-canary.da35795ba8e2 → 4.3.0-canary.eb3bbfa1daab
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 +56 -35
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +4 -12
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/bindingsIndex.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/BaseBoxShapeUtil.js.map +1 -1
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.js.map +2 -2
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
- package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
- package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
- package/dist-cjs/lib/globals/menus.js +1 -1
- package/dist-cjs/lib/globals/menus.js.map +2 -2
- package/dist-cjs/lib/utils/reparenting.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 +56 -35
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +4 -12
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/bindingsIndex.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/BaseBoxShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
- package/dist-esm/lib/globals/menus.mjs +1 -1
- package/dist-esm/lib/globals/menus.mjs.map +2 -2
- package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +10 -10
- package/src/lib/components/default-components/DefaultCanvas.tsx +1 -0
- package/src/lib/editor/Editor.test.ts +10 -10
- package/src/lib/editor/Editor.ts +85 -59
- package/src/lib/editor/bindings/BindingUtil.ts +15 -9
- package/src/lib/editor/derivations/bindingsIndex.ts +2 -2
- package/src/lib/editor/managers/FontManager/FontManager.test.ts +14 -4
- package/src/lib/editor/managers/SnapManager/SnapManager.ts +3 -3
- package/src/lib/editor/shapes/BaseBoxShapeUtil.tsx +2 -2
- package/src/lib/editor/shapes/ShapeUtil.ts +5 -8
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +1 -3
- package/src/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.ts +2 -1
- package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +3 -3
- package/src/lib/editor/types/emit-types.ts +2 -1
- package/src/lib/exports/getSvgJsx.test.ts +10 -19
- package/src/lib/exports/getSvgJsx.tsx +2 -5
- package/src/lib/globals/menus.ts +1 -1
- package/src/lib/utils/reparenting.ts +5 -5
- package/src/version.ts +3 -3
|
@@ -2804,14 +2804,17 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
2804
2804
|
}
|
|
2805
2805
|
if (_willSetInitialBounds) {
|
|
2806
2806
|
this.updateInstanceState({ screenBounds: screenBounds.toJson(), insets });
|
|
2807
|
+
this.emit("resize", screenBounds.toJson());
|
|
2807
2808
|
this.setCamera(this.getCamera());
|
|
2808
2809
|
} else {
|
|
2809
2810
|
if (center && !this.getInstanceState().followingUserId) {
|
|
2810
2811
|
const before = this.getViewportPageBounds().center;
|
|
2811
2812
|
this.updateInstanceState({ screenBounds: screenBounds.toJson(), insets });
|
|
2813
|
+
this.emit("resize", screenBounds.toJson());
|
|
2812
2814
|
this.centerOnPoint(before);
|
|
2813
2815
|
} else {
|
|
2814
2816
|
this.updateInstanceState({ screenBounds: screenBounds.toJson(), insets });
|
|
2817
|
+
this.emit("resize", screenBounds.toJson());
|
|
2815
2818
|
this._setCamera(Vec.From({ ...this.getCamera() }));
|
|
2816
2819
|
}
|
|
2817
2820
|
}
|
|
@@ -4435,30 +4438,18 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
4435
4438
|
getBinding(id) {
|
|
4436
4439
|
return this.store.get(id);
|
|
4437
4440
|
}
|
|
4438
|
-
/**
|
|
4439
|
-
* Get all bindings of a certain type _from_ a particular shape. These are the bindings whose
|
|
4440
|
-
* `fromId` matched the shape's ID.
|
|
4441
|
-
*/
|
|
4442
4441
|
getBindingsFromShape(shape, type) {
|
|
4443
4442
|
const id = typeof shape === "string" ? shape : shape.id;
|
|
4444
4443
|
return this.getBindingsInvolvingShape(id).filter(
|
|
4445
4444
|
(b) => b.fromId === id && b.type === type
|
|
4446
4445
|
);
|
|
4447
4446
|
}
|
|
4448
|
-
/**
|
|
4449
|
-
* Get all bindings of a certain type _to_ a particular shape. These are the bindings whose
|
|
4450
|
-
* `toId` matches the shape's ID.
|
|
4451
|
-
*/
|
|
4452
4447
|
getBindingsToShape(shape, type) {
|
|
4453
4448
|
const id = typeof shape === "string" ? shape : shape.id;
|
|
4454
4449
|
return this.getBindingsInvolvingShape(id).filter(
|
|
4455
4450
|
(b) => b.toId === id && b.type === type
|
|
4456
4451
|
);
|
|
4457
4452
|
}
|
|
4458
|
-
/**
|
|
4459
|
-
* Get all bindings involving a particular shape. This includes bindings where the shape is the
|
|
4460
|
-
* `fromId` or `toId`. If a type is provided, only bindings of that type are returned.
|
|
4461
|
-
*/
|
|
4462
4453
|
getBindingsInvolvingShape(shape, type) {
|
|
4463
4454
|
const id = typeof shape === "string" ? shape : shape.id;
|
|
4464
4455
|
const result = this._getBindingsIndexCache().get(id) ?? EMPTY_ARRAY;
|
|
@@ -7516,6 +7507,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
7516
7507
|
this.setCursor({ type: this._prevCursor, rotation: 0 });
|
|
7517
7508
|
}
|
|
7518
7509
|
}
|
|
7510
|
+
this.emit("event", info);
|
|
7519
7511
|
this.root.handleEvent(info);
|
|
7520
7512
|
return;
|
|
7521
7513
|
}
|