@tldraw/editor 5.2.0-canary.ff23978d50f6 → 5.2.0-next.355d68cf24e8

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.
@@ -22,10 +22,10 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- const version = "5.2.0-canary.ff23978d50f6";
25
+ const version = "5.2.0-next.355d68cf24e8";
26
26
  const publishDates = {
27
27
  major: "2026-05-06T16:28:18.473Z",
28
- minor: "2026-06-05T12:02:54.232Z",
29
- patch: "2026-06-05T12:02:54.232Z"
28
+ minor: "2026-06-05T16:25:52.737Z",
29
+ patch: "2026-06-05T16:25:52.737Z"
30
30
  };
31
31
  //# sourceMappingURL=version.js.map
@@ -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.ff23978d50f6'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-06-05T12:02:54.232Z',\n\tpatch: '2026-06-05T12:02:54.232Z',\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-next.355d68cf24e8'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-06-05T16:25:52.737Z',\n\tpatch: '2026-06-05T16:25:52.737Z',\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -300,7 +300,7 @@ import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
300
300
  import { uniq } from "./lib/utils/uniq.mjs";
301
301
  registerTldrawLibraryVersion(
302
302
  "@tldraw/editor",
303
- "5.2.0-canary.ff23978d50f6",
303
+ "5.2.0-next.355d68cf24e8",
304
304
  "esm"
305
305
  );
306
306
  import { getColorValue } from "./lib/editor/managers/ThemeManager/defaultThemes.mjs";
@@ -2373,6 +2373,11 @@ class Editor extends EventEmitter {
2373
2373
  getConstrainedCamera(point, opts) {
2374
2374
  const currentCamera = this.getCamera();
2375
2375
  let { x, y, z = currentCamera.z } = point;
2376
+ const preserveFocalPoint = (current, requested, rz, z2) => {
2377
+ const cz = currentCamera.z;
2378
+ if (rz === cz) return current;
2379
+ return current + (requested - current) * (1 / z2 - 1 / cz) / (1 / rz - 1 / cz);
2380
+ };
2376
2381
  if (!opts?.force) {
2377
2382
  const cameraOptions = this.getCameraOptions();
2378
2383
  const zoomMin = cameraOptions.zoomSteps[0];
@@ -2392,14 +2397,10 @@ class Editor extends EventEmitter {
2392
2397
  z = this.getInitialZoom();
2393
2398
  }
2394
2399
  if (z < minZ || z > maxZ) {
2395
- const { x: cx, y: cy, z: cz } = currentCamera;
2396
- const cxA = -cx + vsb.w / cz / 2;
2397
- const cyA = -cy + vsb.h / cz / 2;
2400
+ const rz = z;
2398
2401
  z = clamp(z, minZ, maxZ);
2399
- const cxB = -cx + vsb.w / z / 2;
2400
- const cyB = -cy + vsb.h / z / 2;
2401
- x = cx + cxB - cxA;
2402
- y = cy + cyB - cyA;
2402
+ x = preserveFocalPoint(currentCamera.x, x, rz, z);
2403
+ y = preserveFocalPoint(currentCamera.y, y, rz, z);
2403
2404
  }
2404
2405
  const minX = px / z - bounds.x;
2405
2406
  const minY = py / z - bounds.y;
@@ -2468,10 +2469,10 @@ class Editor extends EventEmitter {
2468
2469
  }
2469
2470
  } else {
2470
2471
  if (z > zoomMax || z < zoomMin) {
2471
- const { x: cx, y: cy, z: cz } = currentCamera;
2472
+ const rz = z;
2472
2473
  z = clamp(z, zoomMin, zoomMax);
2473
- x = cx + (-cx + vsb.w / z / 2) - (-cx + vsb.w / cz / 2);
2474
- y = cy + (-cy + vsb.h / z / 2) - (-cy + vsb.h / cz / 2);
2474
+ x = preserveFocalPoint(currentCamera.x, x, rz, z);
2475
+ y = preserveFocalPoint(currentCamera.y, y, rz, z);
2475
2476
  }
2476
2477
  }
2477
2478
  }