@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.
- package/dist-cjs/index.d.ts +3 -3
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +9 -8
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/options.js.map +1 -1
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +3 -3
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +9 -8
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/options.mjs.map +1 -1
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +5 -0
- package/package.json +8 -9
- package/src/lib/editor/Editor.ts +17 -8
- package/src/lib/options.ts +2 -2
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -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.
|
|
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
|
|
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.
|
|
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.
|
|
3090
|
+
this._setCameraState("idle");
|
|
3092
3091
|
}
|
|
3093
3092
|
_tickCameraState() {
|
|
3094
3093
|
this._cameraStateTimeoutRemaining = this.options.cameraMovingTimeoutMs;
|
|
3095
|
-
if (this.
|
|
3096
|
-
this.
|
|
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.
|
|
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
|
-
|
|
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
|
}
|