@tldraw/editor 5.2.0-canary.4f74e5daafbd → 5.2.0-canary.7e69fa3c70ec

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.
@@ -1,8 +1,8 @@
1
- const version = "5.2.0-canary.4f74e5daafbd";
1
+ const version = "5.2.0-canary.7e69fa3c70ec";
2
2
  const publishDates = {
3
3
  major: "2026-05-06T16:28:18.473Z",
4
- minor: "2026-06-03T11:38:15.624Z",
5
- patch: "2026-06-03T11:38:15.624Z"
4
+ minor: "2026-06-05T10:01:00.603Z",
5
+ patch: "2026-06-05T10:01:00.603Z"
6
6
  };
7
7
  export {
8
8
  publishDates,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '5.2.0-canary.4f74e5daafbd'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-06-03T11:38:15.624Z',\n\tpatch: '2026-06-03T11:38:15.624Z',\n}\n"],
4
+ "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '5.2.0-canary.7e69fa3c70ec'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-06-05T10:01:00.603Z',\n\tpatch: '2026-06-05T10:01:00.603Z',\n}\n"],
5
5
  "mappings": "AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/editor",
3
3
  "description": "tldraw infinite canvas SDK (editor).",
4
- "version": "5.2.0-canary.4f74e5daafbd",
4
+ "version": "5.2.0-canary.7e69fa3c70ec",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -49,12 +49,12 @@
49
49
  "@tiptap/core": "^3.12.1",
50
50
  "@tiptap/pm": "^3.12.1",
51
51
  "@tiptap/react": "^3.12.1",
52
- "@tldraw/state": "5.2.0-canary.4f74e5daafbd",
53
- "@tldraw/state-react": "5.2.0-canary.4f74e5daafbd",
54
- "@tldraw/store": "5.2.0-canary.4f74e5daafbd",
55
- "@tldraw/tlschema": "5.2.0-canary.4f74e5daafbd",
56
- "@tldraw/utils": "5.2.0-canary.4f74e5daafbd",
57
- "@tldraw/validate": "5.2.0-canary.4f74e5daafbd",
52
+ "@tldraw/state": "5.2.0-canary.7e69fa3c70ec",
53
+ "@tldraw/state-react": "5.2.0-canary.7e69fa3c70ec",
54
+ "@tldraw/store": "5.2.0-canary.7e69fa3c70ec",
55
+ "@tldraw/tlschema": "5.2.0-canary.7e69fa3c70ec",
56
+ "@tldraw/utils": "5.2.0-canary.7e69fa3c70ec",
57
+ "@tldraw/validate": "5.2.0-canary.7e69fa3c70ec",
58
58
  "classnames": "^2.5.1",
59
59
  "eventemitter3": "^4.0.7",
60
60
  "idb": "^7.1.1",
@@ -10768,6 +10768,16 @@ export class Editor extends EventEmitter<TLEventMap> {
10768
10768
  /** @internal */
10769
10769
  private _selectedShapeIdsAtPointerDown: TLShapeId[] = []
10770
10770
 
10771
+ /**
10772
+ * Whether `_selectedShapeIdsAtPointerDown` holds a pre-gesture selection
10773
+ * captured by a `pointer_down` (the touch path) that a following pinch
10774
+ * should restore. False when no pointer_down preceded the pinch (the
10775
+ * Safari trackpad path uses gesture events), in which case `pinch_start`
10776
+ * captures the live selection instead.
10777
+ * @internal
10778
+ */
10779
+ private _didCaptureSelectionAtPointerDown = false
10780
+
10771
10781
  /** @internal */
10772
10782
  private _longPressTimeout = -1 as any
10773
10783
 
@@ -10933,16 +10943,28 @@ export class Editor extends EventEmitter<TLEventMap> {
10933
10943
  if (inputs.getIsPinching()) return
10934
10944
 
10935
10945
  if (!inputs.getIsEditing()) {
10936
- // Always capture the current selection when pinch starts.
10937
- // This ensures Safari (which uses gesture events instead of wheel)
10938
- // doesn't restore a stale selection from an earlier pointer_down.
10939
- this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds]
10946
+ // If a pointer_down already captured the pre-gesture selection,
10947
+ // keep it: on touch, the first finger's pointer_down can change
10948
+ // the selection before the second finger starts the pinch, and we
10949
+ // want to restore the selection from before that change. When no
10950
+ // pointer_down preceded the pinch (Safari delivers trackpad pinches
10951
+ // as gesture events), capture the live selection now.
10952
+ if (!this._didCaptureSelectionAtPointerDown) {
10953
+ this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds]
10954
+ }
10940
10955
 
10941
10956
  this._didPinch = true
10942
10957
 
10943
10958
  inputs.setIsPinching(true)
10944
10959
 
10945
10960
  this.interrupt()
10961
+
10962
+ // If the first finger changed the selection, roll it back now rather
10963
+ // than waiting for the pinch to end, so the pre-gesture selection is
10964
+ // what's shown during the pinch.
10965
+ if (this._didCaptureSelectionAtPointerDown) {
10966
+ this.setSelectedShapes(this._selectedShapeIdsAtPointerDown)
10967
+ }
10946
10968
  }
10947
10969
 
10948
10970
  this.emit('event', info)
@@ -10994,6 +11016,7 @@ export class Editor extends EventEmitter<TLEventMap> {
10994
11016
  const { _selectedShapeIdsAtPointerDown: shapesToReselect } = this
10995
11017
  this.setSelectedShapes(this._selectedShapeIdsAtPointerDown)
10996
11018
  this._selectedShapeIdsAtPointerDown = []
11019
+ this._didCaptureSelectionAtPointerDown = false
10997
11020
 
10998
11021
  if (this._didPinch) {
10999
11022
  this._didPinch = false
@@ -11122,8 +11145,15 @@ export class Editor extends EventEmitter<TLEventMap> {
11122
11145
  }, this.options.longPressDurationMs)
11123
11146
  }
11124
11147
 
11125
- // Save the selected ids at pointer down
11126
- this._selectedShapeIdsAtPointerDown = this.getSelectedShapeIds()
11148
+ // Save the selected ids at the start of an interaction so a pinch can
11149
+ // restore the pre-gesture selection. Only capture on the first pointer:
11150
+ // on touch, the second finger's pointer_down arrives after the first
11151
+ // has already changed the selection, and we want the earlier snapshot.
11152
+ // Cleared on pointer_up / pinch_end.
11153
+ if (!this._didCaptureSelectionAtPointerDown) {
11154
+ this._selectedShapeIdsAtPointerDown = this.getSelectedShapeIds()
11155
+ this._didCaptureSelectionAtPointerDown = true
11156
+ }
11127
11157
 
11128
11158
  // Firefox bug fix...
11129
11159
  // If it's a left-mouse-click, we store the pointer id for later user
@@ -11243,6 +11273,7 @@ export class Editor extends EventEmitter<TLEventMap> {
11243
11273
  if (this.inputs.getIsRightPointing() && !this.inputs.getIsPanning()) {
11244
11274
  this.inputs.setIsRightPointing(false)
11245
11275
  this._selectedShapeIdsAtPointerDown = []
11276
+ this._didCaptureSelectionAtPointerDown = false
11246
11277
  break // fall through to state chart dispatch as right_click
11247
11278
  }
11248
11279
 
@@ -11289,6 +11320,7 @@ export class Editor extends EventEmitter<TLEventMap> {
11289
11320
  this.slideCamera({ speed: slideSpeed, direction: slideDirection })
11290
11321
  }
11291
11322
  this._selectedShapeIdsAtPointerDown = []
11323
+ this._didCaptureSelectionAtPointerDown = false
11292
11324
  return this
11293
11325
  }
11294
11326
  }
@@ -11307,6 +11339,7 @@ export class Editor extends EventEmitter<TLEventMap> {
11307
11339
  // Clear the stashed selection so the next pinch captures fresh state.
11308
11340
  // This fixes Safari pinch zoom restoring outdated selections.
11309
11341
  this._selectedShapeIdsAtPointerDown = []
11342
+ this._didCaptureSelectionAtPointerDown = false
11310
11343
 
11311
11344
  break
11312
11345
  }
package/src/version.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // This file is automatically generated by internal/scripts/refresh-assets.ts.
2
2
  // Do not edit manually. Or do, I'm a comment, not a cop.
3
3
 
4
- export const version = '5.2.0-canary.4f74e5daafbd'
4
+ export const version = '5.2.0-canary.7e69fa3c70ec'
5
5
  export const publishDates = {
6
6
  major: '2026-05-06T16:28:18.473Z',
7
- minor: '2026-06-03T11:38:15.624Z',
8
- patch: '2026-06-03T11:38:15.624Z',
7
+ minor: '2026-06-05T10:01:00.603Z',
8
+ patch: '2026-06-05T10:01:00.603Z',
9
9
  }