@tldraw/editor 5.2.0-canary.9ef8e979cbfc → 5.2.0-canary.a48e411198d2
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/README.md +7 -1
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +21 -4
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js +1 -1
- package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js.map +2 -2
- 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 +21 -4
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs +1 -1
- package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs.map +2 -2
- 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 +28 -4
- package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.test.ts +14 -0
- package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.ts +6 -3
- package/src/version.ts +3 -3
package/README.md
CHANGED
|
@@ -4,6 +4,12 @@ The core editor and composable parts for tldraw. [Click here](https://tldraw.dev
|
|
|
4
4
|
|
|
5
5
|
You might be more interested in the general package [tldraw](https://github.com/tldraw/tldraw/tree/main/packages/tldraw) instead of using this package directly.
|
|
6
6
|
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
Documentation for the most recent release can be found on [tldraw.dev/docs](https://tldraw.dev/docs), including [reference docs](https://tldraw.dev/reference/editor/Editor). Our release notes can be found [here](https://tldraw.dev/releases).
|
|
10
|
+
|
|
11
|
+
For more agent-friendly docs, see our [LLMs.txt](https://tldraw.dev/llms.txt).
|
|
12
|
+
|
|
7
13
|
## License
|
|
8
14
|
|
|
9
15
|
This project is part of the tldraw SDK. It is provided under the [tldraw SDK license](https://github.com/tldraw/tldraw/blob/main/LICENSE.md).
|
|
@@ -20,7 +26,7 @@ You can find tldraw on npm [here](https://www.npmjs.com/package/@tldraw/tldraw?a
|
|
|
20
26
|
|
|
21
27
|
## Contribution
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
Found a bug? Please [submit an issue](https://github.com/tldraw/tldraw/issues/new).
|
|
24
30
|
|
|
25
31
|
## Community
|
|
26
32
|
|
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.
|
|
382
|
+
"5.2.0-canary.a48e411198d2",
|
|
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
|
|
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(
|
|
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({
|
|
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({
|
|
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) {
|