@tldraw/editor 4.4.0-canary.afdcafe834b3 → 4.4.0-canary.b5c642789999
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 +52 -9
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/components/Shape.js +12 -17
- package/dist-cjs/lib/components/Shape.js.map +2 -2
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +26 -1
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +16 -1
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +19 -11
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +32 -13
- package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +2 -2
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +2 -3
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/hooks/usePeerIds.js +8 -2
- package/dist-cjs/lib/hooks/usePeerIds.js.map +2 -2
- package/dist-cjs/lib/hooks/useShapeCulling.js +75 -0
- package/dist-cjs/lib/hooks/useShapeCulling.js.map +7 -0
- 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 +2 -1
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +52 -9
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/components/Shape.mjs +12 -17
- package/dist-esm/lib/components/Shape.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +27 -2
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +16 -1
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +19 -11
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +32 -13
- package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +2 -3
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePeerIds.mjs +8 -2
- package/dist-esm/lib/hooks/usePeerIds.mjs.map +2 -2
- package/dist-esm/lib/hooks/useShapeCulling.mjs +55 -0
- package/dist-esm/lib/hooks/useShapeCulling.mjs.map +7 -0
- 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 +2 -1
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +22 -2
- package/package.json +8 -9
- package/src/lib/components/Shape.tsx +15 -16
- package/src/lib/components/default-components/CanvasShapeIndicators.tsx +46 -2
- package/src/lib/components/default-components/DefaultCanvas.tsx +24 -2
- package/src/lib/editor/Editor.ts +33 -11
- package/src/lib/editor/derivations/notVisibleShapes.ts +39 -17
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +0 -35
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +4 -8
- package/src/lib/editor/shapes/ShapeUtil.ts +19 -5
- package/src/lib/hooks/usePeerIds.ts +9 -2
- package/src/lib/hooks/useShapeCulling.tsx +98 -0
- package/src/lib/license/LicenseManager.ts +6 -6
- package/src/lib/options.ts +10 -2
- package/src/version.ts +3 -3
|
@@ -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);
|
|
@@ -4596,7 +4598,13 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
4596
4598
|
const fromShapeType = typeof fromShape === "string" ? fromShape : fromShape.type;
|
|
4597
4599
|
const toShapeType = typeof toShape === "string" ? toShape : toShape.type;
|
|
4598
4600
|
const bindingType = typeof binding === "string" ? binding : binding.type;
|
|
4599
|
-
const canBindOpts = {
|
|
4601
|
+
const canBindOpts = {
|
|
4602
|
+
fromShape: typeof fromShape === "string" ? { type: fromShape } : fromShape,
|
|
4603
|
+
toShape: typeof toShape === "string" ? { type: toShape } : toShape,
|
|
4604
|
+
bindingType,
|
|
4605
|
+
fromShapeType,
|
|
4606
|
+
toShapeType
|
|
4607
|
+
};
|
|
4600
4608
|
if (fromShapeType === toShapeType) {
|
|
4601
4609
|
return this.getShapeUtil(fromShapeType).canBind(canBindOpts);
|
|
4602
4610
|
}
|
|
@@ -5736,7 +5744,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5736
5744
|
this.resizeShape(id, shapeScale, {
|
|
5737
5745
|
initialShape: options.initialShape,
|
|
5738
5746
|
initialBounds: options.initialBounds,
|
|
5739
|
-
isAspectRatioLocked: options.isAspectRatioLocked
|
|
5747
|
+
isAspectRatioLocked: options.isAspectRatioLocked,
|
|
5748
|
+
initialPageTransform: options.initialPageTransform
|
|
5740
5749
|
});
|
|
5741
5750
|
if (Math.sign(scale.x) * Math.sign(scale.y) < 0) {
|
|
5742
5751
|
const parentRotation = this.getShapeParentTransform(id).rotation();
|
|
@@ -7567,9 +7576,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
7567
7576
|
case "pinch_start": {
|
|
7568
7577
|
if (inputs.getIsPinching()) return;
|
|
7569
7578
|
if (!inputs.getIsEditing()) {
|
|
7570
|
-
|
|
7571
|
-
this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
|
|
7572
|
-
}
|
|
7579
|
+
this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
|
|
7573
7580
|
this._didPinch = true;
|
|
7574
7581
|
inputs.setIsPinching(true);
|
|
7575
7582
|
this.interrupt();
|
|
@@ -7784,6 +7791,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
7784
7791
|
this.setCurrentTool(this._restoreToolId);
|
|
7785
7792
|
}
|
|
7786
7793
|
}
|
|
7794
|
+
this._selectedShapeIdsAtPointerDown = [];
|
|
7787
7795
|
break;
|
|
7788
7796
|
}
|
|
7789
7797
|
}
|