@tldraw/editor 5.2.0-canary.4f74e5daafbd → 5.2.0-canary.52bf73b34fcf

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.
@@ -746,6 +746,7 @@ export declare class ClickManager {
746
746
  private _clickTimeout?;
747
747
  private _clickScreenPoint?;
748
748
  private _previousScreenPoint?;
749
+ private _isPressingWhilePending;
749
750
  _getClickTimeout(state: TLClickState, id?: string): void;
750
751
  /* Excluded from this release type: _clickState */
751
752
  /**
@@ -4444,6 +4445,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4444
4445
  /* Excluded from this release type: _restoreToolId */
4445
4446
  /* Excluded from this release type: _didPinch */
4446
4447
  /* Excluded from this release type: _selectedShapeIdsAtPointerDown */
4448
+ /* Excluded from this release type: _didCaptureSelectionAtPointerDown */
4447
4449
  /* Excluded from this release type: _longPressTimeout */
4448
4450
  /* Excluded from this release type: capturedPointerId */
4449
4451
  /* Excluded from this release type: performanceTracker */
@@ -7165,8 +7167,6 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
7165
7167
  onLongPress?(info: TLPointerEventInfo): void;
7166
7168
  onPointerUp?(info: TLPointerEventInfo): void;
7167
7169
  onDoubleClick?(info: TLClickEventInfo): void;
7168
- onTripleClick?(info: TLClickEventInfo): void;
7169
- onQuadrupleClick?(info: TLClickEventInfo): void;
7170
7170
  onRightClick?(info: TLPointerEventInfo): void;
7171
7171
  onMiddleClick?(info: TLPointerEventInfo): void;
7172
7172
  onKeyDown?(info: TLKeyboardEventInfo): void;
@@ -7566,17 +7566,17 @@ export declare type TLClickEvent = (info: TLClickEventInfo) => void;
7566
7566
  export declare type TLClickEventInfo = TLBaseEventInfo & {
7567
7567
  button: number;
7568
7568
  name: TLCLickEventName;
7569
- phase: 'down' | 'settle' | 'up';
7569
+ phase: 'down' | 'settle-down' | 'settle-up' | 'up';
7570
7570
  point: VecLike;
7571
7571
  pointerId: number;
7572
7572
  type: 'click';
7573
7573
  } & TLPointerEventTarget;
7574
7574
 
7575
7575
  /** @public */
7576
- export declare type TLCLickEventName = 'double_click' | 'quadruple_click' | 'triple_click';
7576
+ export declare type TLCLickEventName = 'double_click';
7577
7577
 
7578
7578
  /** @public */
7579
- export declare type TLClickState = 'idle' | 'overflow' | 'pendingDouble' | 'pendingOverflow' | 'pendingQuadruple' | 'pendingTriple';
7579
+ export declare type TLClickState = 'idle' | 'overflow' | 'pendingDouble' | 'pendingOverflow';
7580
7580
 
7581
7581
  /**
7582
7582
  * Raw clipboard paste payload, before tldraw parses clipboard contents into {@link TLExternalContent}.
@@ -8356,8 +8356,6 @@ export declare interface TLEventHandlers {
8356
8356
  onLongPress: TLPointerEvent;
8357
8357
  onRightClick: TLPointerEvent;
8358
8358
  onDoubleClick: TLClickEvent;
8359
- onTripleClick: TLClickEvent;
8360
- onQuadrupleClick: TLClickEvent;
8361
8359
  onMiddleClick: TLPointerEvent;
8362
8360
  onPointerUp: TLPointerEvent;
8363
8361
  onKeyDown: TLKeyboardEvent;
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.4f74e5daafbd",
383
+ "5.2.0-canary.52bf73b34fcf",
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
  }