@tldraw/editor 4.4.0-canary.a0c0a16bde63 → 4.4.0-canary.afdcafe834b3

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.
@@ -2259,10 +2259,10 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2259
2259
  */
2260
2260
  stopFollowingUser(): this;
2261
2261
  /* Excluded from this release type: getUnorderedRenderingShapes */
2262
+ private _cameraState;
2262
2263
  private _cameraStateTimeoutRemaining;
2263
2264
  private _decayCameraStateTimeout;
2264
2265
  private _tickCameraState;
2265
- private _setCameraState;
2266
2266
  /**
2267
2267
  * Whether the camera is moving or idle.
2268
2268
  *
package/dist-cjs/index.js CHANGED
@@ -372,7 +372,7 @@ var import_uniq = require("./lib/utils/uniq");
372
372
  var import_window_open = require("./lib/utils/window-open");
373
373
  (0, import_utils.registerTldrawLibraryVersion)(
374
374
  "@tldraw/editor",
375
- "4.4.0-canary.a0c0a16bde63",
375
+ "4.4.0-canary.afdcafe834b3",
376
376
  "cjs"
377
377
  );
378
378
  //# sourceMappingURL=index.js.map
@@ -298,6 +298,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
298
298
  // unmount / remount in the DOM, which is expensive; and computing visibility is
299
299
  // also expensive in large projects. For this reason, we use a second bounding
300
300
  // box just for rendering, and we only update after the camera stops moving.
301
+ __publicField(this, "_cameraState", (0, import_state.atom)("camera state", "idle"));
301
302
  __publicField(this, "_cameraStateTimeoutRemaining", 0);
302
303
  /* @internal */
303
304
  __publicField(this, "_currentPageShapeIds");
@@ -3087,18 +3088,15 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3087
3088
  this._cameraStateTimeoutRemaining -= elapsed;
3088
3089
  if (this._cameraStateTimeoutRemaining > 0) return;
3089
3090
  this.off("tick", this._decayCameraStateTimeout);
3090
- this._setCameraState("idle");
3091
+ this._cameraState.set("idle");
3091
3092
  }
3092
3093
  _tickCameraState() {
3093
3094
  this._cameraStateTimeoutRemaining = this.options.cameraMovingTimeoutMs;
3094
- if (this.getInstanceState().cameraState !== "idle") return;
3095
- this._setCameraState("moving");
3095
+ if (this._cameraState.__unsafe__getWithoutCapture() !== "idle") return;
3096
+ this._cameraState.set("moving");
3096
3097
  this._debouncedZoomLevel.set((0, import_state.unsafe__withoutCapture)(() => this.getCamera().z));
3097
3098
  this.on("tick", this._decayCameraStateTimeout);
3098
3099
  }
3099
- _setCameraState(cameraState) {
3100
- this.updateInstanceState({ cameraState }, { history: "ignore" });
3101
- }
3102
3100
  /**
3103
3101
  * Whether the camera is moving or idle.
3104
3102
  *
@@ -3110,7 +3108,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3110
3108
  * @public
3111
3109
  */
3112
3110
  getCameraState() {
3113
- return this.getInstanceState().cameraState;
3111
+ return this._cameraState.get();
3114
3112
  }
3115
3113
  getRenderingShapes() {
3116
3114
  const renderingShapes = this.getUnorderedRenderingShapes(true);
@@ -7569,7 +7567,9 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7569
7567
  case "pinch_start": {
7570
7568
  if (inputs.getIsPinching()) return;
7571
7569
  if (!inputs.getIsEditing()) {
7572
- this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
7570
+ if (!this._selectedShapeIdsAtPointerDown.length) {
7571
+ this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
7572
+ }
7573
7573
  this._didPinch = true;
7574
7574
  inputs.setIsPinching(true);
7575
7575
  this.interrupt();
@@ -7784,7 +7784,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7784
7784
  this.setCurrentTool(this._restoreToolId);
7785
7785
  }
7786
7786
  }
7787
- this._selectedShapeIdsAtPointerDown = [];
7788
7787
  break;
7789
7788
  }
7790
7789
  }