@tldraw/editor 3.13.0-canary.2c1fb1ac1f1a → 3.13.0-canary.3000265147be

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.
@@ -5438,7 +5438,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5438
5438
  */
5439
5439
  onClick?(shape: Shape): TLShapePartial<Shape> | void;
5440
5440
  /**
5441
- * A callback called when a shape finishes being editing.
5441
+ * A callback called when a shape starts being edited.
5442
+ *
5443
+ * @param shape - The shape.
5444
+ * @public
5445
+ */
5446
+ onEditStart?(shape: Shape): void;
5447
+ /**
5448
+ * A callback called when a shape finishes being edited.
5442
5449
  *
5443
5450
  * @param shape - The shape.
5444
5451
  * @public
package/dist-cjs/index.js CHANGED
@@ -361,7 +361,7 @@ function debugEnableLicensing() {
361
361
  }
362
362
  (0, import_utils.registerTldrawLibraryVersion)(
363
363
  "@tldraw/editor",
364
- "3.13.0-canary.2c1fb1ac1f1a",
364
+ "3.13.0-canary.3000265147be",
365
365
  "cjs"
366
366
  );
367
367
  //# sourceMappingURL=index.js.map
@@ -424,7 +424,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
424
424
  ) : getShapeVisibility;
425
425
  this.options = { ...import_options.defaultTldrawOptions, ...options };
426
426
  this.store = store;
427
- this.disposables.add(this.store.dispose.bind(this.store));
428
427
  this.history = new import_HistoryManager.HistoryManager({
429
428
  store,
430
429
  annotateError: (error) => {
@@ -836,6 +835,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
836
835
  dispose() {
837
836
  this.disposables.forEach((dispose) => dispose());
838
837
  this.disposables.clear();
838
+ this.store.dispose();
839
839
  this.isDisposed = true;
840
840
  }
841
841
  getShapeUtil(arg) {
@@ -1738,13 +1738,21 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1738
1738
  setEditingShape(shape) {
1739
1739
  const id = typeof shape === "string" ? shape : shape?.id ?? null;
1740
1740
  this.setRichTextEditor(null);
1741
- if (id !== this.getEditingShapeId()) {
1741
+ const prevEditingShapeId = this.getEditingShapeId();
1742
+ if (id !== prevEditingShapeId) {
1742
1743
  if (id) {
1743
1744
  const shape2 = this.getShape(id);
1744
1745
  if (shape2 && this.getShapeUtil(shape2).canEdit(shape2)) {
1745
1746
  this.run(
1746
1747
  () => {
1747
1748
  this._updateCurrentPageState({ editingShapeId: id });
1749
+ if (prevEditingShapeId) {
1750
+ const prevEditingShape = this.getShape(prevEditingShapeId);
1751
+ if (prevEditingShape) {
1752
+ this.getShapeUtil(prevEditingShape).onEditEnd?.(prevEditingShape);
1753
+ }
1754
+ }
1755
+ this.getShapeUtil(shape2).onEditStart?.(shape2);
1748
1756
  },
1749
1757
  { history: "ignore" }
1750
1758
  );
@@ -1755,6 +1763,12 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1755
1763
  () => {
1756
1764
  this._updateCurrentPageState({ editingShapeId: null });
1757
1765
  this._currentRichTextEditor.set(null);
1766
+ if (prevEditingShapeId) {
1767
+ const prevEditingShape = this.getShape(prevEditingShapeId);
1768
+ if (prevEditingShape) {
1769
+ this.getShapeUtil(prevEditingShape).onEditEnd?.(prevEditingShape);
1770
+ }
1771
+ }
1758
1772
  },
1759
1773
  { history: "ignore" }
1760
1774
  );
@@ -7539,12 +7553,10 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7539
7553
  const { x: cx, y: cy, z: cz } = (0, import_state.unsafe__withoutCapture)(() => this.getCamera());
7540
7554
  if (this.inputs.isPanning && this.inputs.isPointing) {
7541
7555
  const { currentScreenPoint, previousScreenPoint } = this.inputs;
7542
- const { panSpeed } = cameraOptions;
7543
7556
  const offset = import_Vec.Vec.Sub(currentScreenPoint, previousScreenPoint);
7544
- this.setCamera(
7545
- new import_Vec.Vec(cx + offset.x * panSpeed / cz, cy + offset.y * panSpeed / cz, cz),
7546
- { immediate: true }
7547
- );
7557
+ this.setCamera(new import_Vec.Vec(cx + offset.x / cz, cy + offset.y / cz, cz), {
7558
+ immediate: true
7559
+ });
7548
7560
  this.maybeTrackPerformance("Panning");
7549
7561
  return;
7550
7562
  }