@tldraw/editor 5.2.0-canary.e22474d279fb → 5.2.0-canary.fe03bcdddf34

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.
@@ -4444,6 +4444,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4444
4444
  /* Excluded from this release type: _restoreToolId */
4445
4445
  /* Excluded from this release type: _didPinch */
4446
4446
  /* Excluded from this release type: _selectedShapeIdsAtPointerDown */
4447
+ /* Excluded from this release type: _didCaptureSelectionAtPointerDown */
4447
4448
  /* Excluded from this release type: _longPressTimeout */
4448
4449
  /* Excluded from this release type: capturedPointerId */
4449
4450
  /* Excluded from this release type: performanceTracker */
package/dist-cjs/index.js CHANGED
@@ -380,7 +380,7 @@ var import_uniq = require("./lib/utils/uniq");
380
380
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
381
381
  (0, import_utils.registerTldrawLibraryVersion)(
382
382
  "@tldraw/editor",
383
- "5.2.0-canary.e22474d279fb",
383
+ "5.2.0-canary.fe03bcdddf34",
384
384
  "cjs"
385
385
  );
386
386
  //# sourceMappingURL=index.js.map
@@ -7834,6 +7834,15 @@ class Editor extends import_eventemitter3.default {
7834
7834
  _didPinch = false;
7835
7835
  /** @internal */
7836
7836
  _selectedShapeIdsAtPointerDown = [];
7837
+ /**
7838
+ * Whether `_selectedShapeIdsAtPointerDown` holds a pre-gesture selection
7839
+ * captured by a `pointer_down` (the touch path) that a following pinch
7840
+ * should restore. False when no pointer_down preceded the pinch (the
7841
+ * Safari trackpad path uses gesture events), in which case `pinch_start`
7842
+ * captures the live selection instead.
7843
+ * @internal
7844
+ */
7845
+ _didCaptureSelectionAtPointerDown = false;
7837
7846
  /** @internal */
7838
7847
  _longPressTimeout = -1;
7839
7848
  /** @internal */
@@ -7966,10 +7975,15 @@ class Editor extends import_eventemitter3.default {
7966
7975
  case "pinch_start": {
7967
7976
  if (inputs.getIsPinching()) return;
7968
7977
  if (!inputs.getIsEditing()) {
7969
- this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
7978
+ if (!this._didCaptureSelectionAtPointerDown) {
7979
+ this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
7980
+ }
7970
7981
  this._didPinch = true;
7971
7982
  inputs.setIsPinching(true);
7972
7983
  this.interrupt();
7984
+ if (this._didCaptureSelectionAtPointerDown) {
7985
+ this.setSelectedShapes(this._selectedShapeIdsAtPointerDown);
7986
+ }
7973
7987
  }
7974
7988
  this.emit("event", info);
7975
7989
  return;
@@ -8009,6 +8023,7 @@ class Editor extends import_eventemitter3.default {
8009
8023
  const { _selectedShapeIdsAtPointerDown: shapesToReselect } = this;
8010
8024
  this.setSelectedShapes(this._selectedShapeIdsAtPointerDown);
8011
8025
  this._selectedShapeIdsAtPointerDown = [];
8026
+ this._didCaptureSelectionAtPointerDown = false;
8012
8027
  if (this._didPinch) {
8013
8028
  this._didPinch = false;
8014
8029
  if (shapesToReselect.length > 0) {
@@ -8102,7 +8117,10 @@ class Editor extends import_eventemitter3.default {
8102
8117
  });
8103
8118
  }, this.options.longPressDurationMs);
8104
8119
  }
8105
- this._selectedShapeIdsAtPointerDown = this.getSelectedShapeIds();
8120
+ if (!this._didCaptureSelectionAtPointerDown) {
8121
+ this._selectedShapeIdsAtPointerDown = this.getSelectedShapeIds();
8122
+ this._didCaptureSelectionAtPointerDown = true;
8123
+ }
8106
8124
  if (info.button === import_constants.LEFT_MOUSE_BUTTON) this.capturedPointerId = info.pointerId;
8107
8125
  inputs.buttons.add(info.button);
8108
8126
  inputs.setIsPointing(true);
@@ -8175,6 +8193,7 @@ class Editor extends import_eventemitter3.default {
8175
8193
  if (this.inputs.getIsRightPointing() && !this.inputs.getIsPanning()) {
8176
8194
  this.inputs.setIsRightPointing(false);
8177
8195
  this._selectedShapeIdsAtPointerDown = [];
8196
+ this._didCaptureSelectionAtPointerDown = false;
8178
8197
  break;
8179
8198
  }
8180
8199
  this.inputs.setIsRightPointing(false);
@@ -8212,6 +8231,7 @@ class Editor extends import_eventemitter3.default {
8212
8231
  this.slideCamera({ speed: slideSpeed, direction: slideDirection });
8213
8232
  }
8214
8233
  this._selectedShapeIdsAtPointerDown = [];
8234
+ this._didCaptureSelectionAtPointerDown = false;
8215
8235
  return this;
8216
8236
  }
8217
8237
  }
@@ -8225,6 +8245,7 @@ class Editor extends import_eventemitter3.default {
8225
8245
  }
8226
8246
  }
8227
8247
  this._selectedShapeIdsAtPointerDown = [];
8248
+ this._didCaptureSelectionAtPointerDown = false;
8228
8249
  break;
8229
8250
  }
8230
8251
  }