@tldraw/editor 5.2.0-canary.cdae9f7c540a → 5.2.0-canary.cdd9a45fc580

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.
package/dist-cjs/index.js CHANGED
@@ -379,7 +379,7 @@ var import_uniq = require("./lib/utils/uniq");
379
379
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
380
380
  (0, import_utils.registerTldrawLibraryVersion)(
381
381
  "@tldraw/editor",
382
- "5.2.0-canary.cdae9f7c540a",
382
+ "5.2.0-canary.cdd9a45fc580",
383
383
  "cjs"
384
384
  );
385
385
  //# sourceMappingURL=index.js.map
@@ -2862,14 +2862,25 @@ class Editor extends import_eventemitter3.default {
2862
2862
  this.off("stop-camera-animation", cancel);
2863
2863
  };
2864
2864
  this.once("stop-camera-animation", cancel);
2865
+ const dirZ = direction.z ?? 0;
2865
2866
  const moveCamera = (elapsed) => {
2866
2867
  const { x: cx, y: cy, z: cz } = this.getCamera();
2867
- const movementVec = import_Vec.Vec.Mul(direction, currentSpeed * elapsed / cz);
2868
+ const dx = direction.x * (currentSpeed * elapsed) / cz;
2869
+ const dy = direction.y * (currentSpeed * elapsed) / cz;
2870
+ let newCx = cx + dx;
2871
+ let newCy = cy + dy;
2872
+ let newCz = cz;
2873
+ if (dirZ !== 0) {
2874
+ newCz = cz * (1 + dirZ * currentSpeed * elapsed);
2875
+ const center = this.getViewportScreenCenter();
2876
+ newCx += center.x / newCz - center.x / cz;
2877
+ newCy += center.y / newCz - center.y / cz;
2878
+ }
2868
2879
  currentSpeed *= 1 - friction;
2869
2880
  if (currentSpeed < speedThreshold) {
2870
2881
  cancel();
2871
2882
  } else {
2872
- this._setCamera(new import_Vec.Vec(cx + movementVec.x, cy + movementVec.y, cz));
2883
+ this._setCamera(new import_Vec.Vec(newCx, newCy, newCz));
2873
2884
  }
2874
2885
  };
2875
2886
  this.on("tick", moveCamera);
@@ -8229,7 +8240,10 @@ class Editor extends import_eventemitter3.default {
8229
8240
  this.setCursor({ type: this._prevCursor, rotation: 0 });
8230
8241
  }
8231
8242
  if (slideSpeed > 0) {
8232
- this.slideCamera({ speed: slideSpeed, direction: slideDirection });
8243
+ this.slideCamera({
8244
+ speed: slideSpeed,
8245
+ direction: { x: slideDirection.x, y: slideDirection.y, z: 0 }
8246
+ });
8233
8247
  }
8234
8248
  this._selectedShapeIdsAtPointerDown = [];
8235
8249
  this._didCaptureSelectionAtPointerDown = false;
@@ -8237,7 +8251,10 @@ class Editor extends import_eventemitter3.default {
8237
8251
  }
8238
8252
  }
8239
8253
  if (slideSpeed > 0) {
8240
- this.slideCamera({ speed: slideSpeed, direction: slideDirection });
8254
+ this.slideCamera({
8255
+ speed: slideSpeed,
8256
+ direction: { x: slideDirection.x, y: slideDirection.y, z: 0 }
8257
+ });
8241
8258
  }
8242
8259
  } else {
8243
8260
  if (info.button === import_constants.STYLUS_ERASER_BUTTON) {