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

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;
2263
2262
  private _cameraStateTimeoutRemaining;
2264
2263
  private _decayCameraStateTimeout;
2265
2264
  private _tickCameraState;
2265
+ private _setCameraState;
2266
2266
  /**
2267
2267
  * Whether the camera is moving or idle.
2268
2268
  *
@@ -7022,13 +7022,13 @@ export declare interface TldrawOptions {
7022
7022
  readonly branding?: string;
7023
7023
  /**
7024
7024
  * Whether to use debounced zoom level for certain rendering optimizations. When true,
7025
- * `editor.getDebouncedZoomLevel()` returns a cached zoom value while the camera is moving,
7025
+ * `editor.getEfficientZoomLevel()` returns a cached zoom value while the camera is moving,
7026
7026
  * reducing re-renders. When false, it always returns the current zoom level.
7027
7027
  */
7028
7028
  readonly debouncedZoom: boolean;
7029
7029
  /**
7030
7030
  * The number of shapes that must be on the page for the debounced zoom level to be used.
7031
- * Defaults to 300 shapes.
7031
+ * Defaults to 500 shapes.
7032
7032
  */
7033
7033
  readonly debouncedZoomThreshold: number;
7034
7034
  /**
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.afdcafe834b3",
375
+ "4.4.0-canary.b80d167101d1",
376
376
  "cjs"
377
377
  );
378
378
  //# sourceMappingURL=index.js.map
@@ -298,7 +298,6 @@ 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"));
302
301
  __publicField(this, "_cameraStateTimeoutRemaining", 0);
303
302
  /* @internal */
304
303
  __publicField(this, "_currentPageShapeIds");
@@ -3088,15 +3087,18 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3088
3087
  this._cameraStateTimeoutRemaining -= elapsed;
3089
3088
  if (this._cameraStateTimeoutRemaining > 0) return;
3090
3089
  this.off("tick", this._decayCameraStateTimeout);
3091
- this._cameraState.set("idle");
3090
+ this._setCameraState("idle");
3092
3091
  }
3093
3092
  _tickCameraState() {
3094
3093
  this._cameraStateTimeoutRemaining = this.options.cameraMovingTimeoutMs;
3095
- if (this._cameraState.__unsafe__getWithoutCapture() !== "idle") return;
3096
- this._cameraState.set("moving");
3094
+ if (this.getInstanceState().cameraState !== "idle") return;
3095
+ this._setCameraState("moving");
3097
3096
  this._debouncedZoomLevel.set((0, import_state.unsafe__withoutCapture)(() => this.getCamera().z));
3098
3097
  this.on("tick", this._decayCameraStateTimeout);
3099
3098
  }
3099
+ _setCameraState(cameraState) {
3100
+ this.updateInstanceState({ cameraState }, { history: "ignore" });
3101
+ }
3100
3102
  /**
3101
3103
  * Whether the camera is moving or idle.
3102
3104
  *
@@ -3108,7 +3110,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3108
3110
  * @public
3109
3111
  */
3110
3112
  getCameraState() {
3111
- return this._cameraState.get();
3113
+ return this.getInstanceState().cameraState;
3112
3114
  }
3113
3115
  getRenderingShapes() {
3114
3116
  const renderingShapes = this.getUnorderedRenderingShapes(true);
@@ -7567,9 +7569,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7567
7569
  case "pinch_start": {
7568
7570
  if (inputs.getIsPinching()) return;
7569
7571
  if (!inputs.getIsEditing()) {
7570
- if (!this._selectedShapeIdsAtPointerDown.length) {
7571
- this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
7572
- }
7572
+ this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
7573
7573
  this._didPinch = true;
7574
7574
  inputs.setIsPinching(true);
7575
7575
  this.interrupt();
@@ -7784,6 +7784,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7784
7784
  this.setCurrentTool(this._restoreToolId);
7785
7785
  }
7786
7786
  }
7787
+ this._selectedShapeIdsAtPointerDown = [];
7787
7788
  break;
7788
7789
  }
7789
7790
  }