@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.
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +11 -10
- package/dist-cjs/lib/editor/Editor.js.map +3 -3
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +11 -10
- package/dist-esm/lib/editor/Editor.mjs.map +3 -3
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/editor/Editor.ts +20 -14
- package/src/version.ts +3 -3
package/dist-cjs/version.js
CHANGED
|
@@ -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-
|
|
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-
|
|
29
|
-
patch: "2026-06-
|
|
28
|
+
minor: "2026-06-05T16:25:52.737Z",
|
|
29
|
+
patch: "2026-06-05T16:25:52.737Z"
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=version.js.map
|
package/dist-cjs/version.js.map
CHANGED
|
@@ -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-
|
|
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
|
}
|
package/dist-esm/index.mjs
CHANGED
|
@@ -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-
|
|
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
|
|
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
|
-
|
|
2400
|
-
|
|
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
|
|
2472
|
+
const rz = z;
|
|
2472
2473
|
z = clamp(z, zoomMin, zoomMax);
|
|
2473
|
-
x =
|
|
2474
|
-
y =
|
|
2474
|
+
x = preserveFocalPoint(currentCamera.x, x, rz, z);
|
|
2475
|
+
y = preserveFocalPoint(currentCamera.y, y, rz, z);
|
|
2475
2476
|
}
|
|
2476
2477
|
}
|
|
2477
2478
|
}
|