@tldraw/editor 3.15.0-canary.604030fd2dae → 3.15.0-canary.73ea7178c697
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 +5 -4
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +20 -2
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +96 -101
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
- package/dist-cjs/lib/primitives/intersect.js +4 -4
- package/dist-cjs/lib/primitives/intersect.js.map +2 -2
- package/dist-cjs/lib/primitives/utils.js +4 -0
- package/dist-cjs/lib/primitives/utils.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 +5 -4
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +20 -2
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +96 -101
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
- package/dist-esm/lib/primitives/intersect.mjs +5 -5
- package/dist-esm/lib/primitives/intersect.mjs.map +2 -2
- package/dist-esm/lib/primitives/utils.mjs +4 -0
- package/dist-esm/lib/primitives/utils.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.test.ts +407 -0
- package/src/lib/editor/Editor.ts +29 -4
- package/src/lib/editor/managers/TextManager/TextManager.ts +108 -128
- package/src/lib/primitives/intersect.test.ts +946 -0
- package/src/lib/primitives/intersect.ts +12 -5
- package/src/lib/primitives/utils.ts +11 -0
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1553,7 +1553,9 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1553
1553
|
*/
|
|
1554
1554
|
deselect(...shapes: TLShape[] | TLShapeId[]): this;
|
|
1555
1555
|
/**
|
|
1556
|
-
* Select all
|
|
1556
|
+
* Select all shapes. If the user has selected shapes that share a parent,
|
|
1557
|
+
* select all shapes within that parent. If the user has not selected any shapes,
|
|
1558
|
+
* or if the shapes shapes are only on select all shapes on the current page.
|
|
1557
1559
|
*
|
|
1558
1560
|
* @example
|
|
1559
1561
|
* ```ts
|
|
@@ -4517,7 +4519,7 @@ export declare function intersectLineSegmentCircle(a1: VecLike, a2: VecLike, c:
|
|
|
4517
4519
|
* @param b2 - The second segment's second point.
|
|
4518
4520
|
* @public
|
|
4519
4521
|
*/
|
|
4520
|
-
export declare function intersectLineSegmentLineSegment(a1: VecLike, a2: VecLike, b1: VecLike, b2: VecLike): null | Vec;
|
|
4522
|
+
export declare function intersectLineSegmentLineSegment(a1: VecLike, a2: VecLike, b1: VecLike, b2: VecLike, precision?: number): null | Vec;
|
|
4521
4523
|
|
|
4522
4524
|
/**
|
|
4523
4525
|
* Find the intersections between a line segment and a closed polygon.
|
|
@@ -5795,10 +5797,9 @@ export declare const TAB_ID: string;
|
|
|
5795
5797
|
export declare class TextManager {
|
|
5796
5798
|
editor: Editor;
|
|
5797
5799
|
private elm;
|
|
5798
|
-
private defaultStyles;
|
|
5799
5800
|
constructor(editor: Editor);
|
|
5801
|
+
private setElementStyles;
|
|
5800
5802
|
dispose(): void;
|
|
5801
|
-
private resetElmStyles;
|
|
5802
5803
|
measureText(textToMeasure: string, opts: TLMeasureTextOpts): BoxModel & {
|
|
5803
5804
|
scrollWidth: number;
|
|
5804
5805
|
};
|
package/dist-cjs/index.js
CHANGED
|
@@ -1432,7 +1432,9 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
1432
1432
|
return this;
|
|
1433
1433
|
}
|
|
1434
1434
|
/**
|
|
1435
|
-
* Select all
|
|
1435
|
+
* Select all shapes. If the user has selected shapes that share a parent,
|
|
1436
|
+
* select all shapes within that parent. If the user has not selected any shapes,
|
|
1437
|
+
* or if the shapes shapes are only on select all shapes on the current page.
|
|
1436
1438
|
*
|
|
1437
1439
|
* @example
|
|
1438
1440
|
* ```ts
|
|
@@ -1442,7 +1444,23 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
1442
1444
|
* @public
|
|
1443
1445
|
*/
|
|
1444
1446
|
selectAll() {
|
|
1445
|
-
|
|
1447
|
+
let parentToSelectWithinId = null;
|
|
1448
|
+
const selectedShapeIds = this.getSelectedShapeIds();
|
|
1449
|
+
if (selectedShapeIds.length > 0) {
|
|
1450
|
+
for (const id of selectedShapeIds) {
|
|
1451
|
+
const shape = this.getShape(id);
|
|
1452
|
+
if (!shape) continue;
|
|
1453
|
+
if (parentToSelectWithinId === null) {
|
|
1454
|
+
parentToSelectWithinId = shape.parentId;
|
|
1455
|
+
} else if (parentToSelectWithinId !== shape.parentId) {
|
|
1456
|
+
return this;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
if (!parentToSelectWithinId) {
|
|
1461
|
+
parentToSelectWithinId = this.getCurrentPageId();
|
|
1462
|
+
}
|
|
1463
|
+
const ids = this.getSortedChildIdsForParent(parentToSelectWithinId);
|
|
1446
1464
|
if (ids.length <= 0) return this;
|
|
1447
1465
|
this.setSelectedShapes(this._getUnlockedShapeIds(ids));
|
|
1448
1466
|
return this;
|