@tldraw/editor 4.4.0-canary.2f051ecbee73 → 4.4.0-canary.3d13b40b6c39
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 +21 -4
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +10 -9
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/tools/RootState.js +0 -13
- package/dist-cjs/lib/editor/tools/RootState.js.map +2 -2
- package/dist-cjs/lib/license/LicenseManager.js +6 -6
- package/dist-cjs/lib/license/LicenseManager.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 +21 -4
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +10 -9
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/RootState.mjs +0 -13
- package/dist-esm/lib/editor/tools/RootState.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs +6 -6
- package/dist-esm/lib/license/LicenseManager.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 +9 -0
- package/package.json +8 -9
- package/src/lib/editor/Editor.ts +18 -9
- package/src/lib/editor/tools/RootState.ts +0 -16
- package/src/lib/license/LicenseManager.ts +6 -6
- 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
|
*
|
|
@@ -2761,7 +2761,24 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2761
2761
|
hitInside?: boolean;
|
|
2762
2762
|
margin?: number;
|
|
2763
2763
|
}): TLShape[];
|
|
2764
|
-
|
|
2764
|
+
/**
|
|
2765
|
+
* Get shape IDs within the given bounds.
|
|
2766
|
+
*
|
|
2767
|
+
* Note: Uses shape page bounds only. Frames with labels outside their bounds
|
|
2768
|
+
* may not be included even if the label is within the search bounds.
|
|
2769
|
+
*
|
|
2770
|
+
* Note: Results are unordered. If you need z-order, combine with sorted shapes:
|
|
2771
|
+
* ```ts
|
|
2772
|
+
* const candidates = editor.getShapeIdsInsideBounds(bounds)
|
|
2773
|
+
* const sorted = editor.getCurrentPageShapesSorted().filter(s => candidates.has(s.id))
|
|
2774
|
+
* ```
|
|
2775
|
+
*
|
|
2776
|
+
* @param bounds - The bounds to search within.
|
|
2777
|
+
* @returns Unordered set of shape IDs within the given bounds.
|
|
2778
|
+
*
|
|
2779
|
+
* @public
|
|
2780
|
+
*/
|
|
2781
|
+
getShapeIdsInsideBounds(bounds: Box): Set<TLShapeId>;
|
|
2765
2782
|
/**
|
|
2766
2783
|
* Test whether a point (in the current page space) will will a shape. This method takes into account masks,
|
|
2767
2784
|
* such as when a shape is the child of a frame and is partially clipped by the frame.
|
|
@@ -7022,13 +7039,13 @@ export declare interface TldrawOptions {
|
|
|
7022
7039
|
readonly branding?: string;
|
|
7023
7040
|
/**
|
|
7024
7041
|
* Whether to use debounced zoom level for certain rendering optimizations. When true,
|
|
7025
|
-
* `editor.
|
|
7042
|
+
* `editor.getEfficientZoomLevel()` returns a cached zoom value while the camera is moving,
|
|
7026
7043
|
* reducing re-renders. When false, it always returns the current zoom level.
|
|
7027
7044
|
*/
|
|
7028
7045
|
readonly debouncedZoom: boolean;
|
|
7029
7046
|
/**
|
|
7030
7047
|
* The number of shapes that must be on the page for the debounced zoom level to be used.
|
|
7031
|
-
* Defaults to
|
|
7048
|
+
* Defaults to 500 shapes.
|
|
7032
7049
|
*/
|
|
7033
7050
|
readonly debouncedZoomThreshold: number;
|
|
7034
7051
|
/**
|
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.3d13b40b6c39",
|
|
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);
|
|
@@ -4053,7 +4055,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
4053
4055
|
* @param bounds - The bounds to search within.
|
|
4054
4056
|
* @returns Unordered set of shape IDs within the given bounds.
|
|
4055
4057
|
*
|
|
4056
|
-
* @
|
|
4058
|
+
* @public
|
|
4057
4059
|
*/
|
|
4058
4060
|
getShapeIdsInsideBounds(bounds) {
|
|
4059
4061
|
return this._spatialIndex.getShapeIdsInsideBounds(bounds);
|
|
@@ -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
|
}
|