@plait/core 0.74.0 → 0.75.0-next.1
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/esm2022/core/list-render.mjs +3 -2
- package/esm2022/interfaces/board.mjs +1 -1
- package/esm2022/interfaces/node.mjs +2 -2
- package/esm2022/plugins/with-hand.mjs +21 -4
- package/esm2022/plugins/with-hotkey.mjs +2 -2
- package/esm2022/plugins/with-selection.mjs +19 -7
- package/esm2022/transforms/board.mjs +4 -5
- package/esm2022/utils/index.mjs +2 -1
- package/esm2022/utils/math.mjs +38 -9
- package/esm2022/utils/mobile.mjs +7 -0
- package/esm2022/utils/pointer.mjs +13 -0
- package/esm2022/utils/selected-element.mjs +11 -11
- package/fesm2022/plait-core.mjs +107 -34
- package/fesm2022/plait-core.mjs.map +1 -1
- package/interfaces/board.d.ts +1 -1
- package/package.json +1 -1
- package/transforms/board.d.ts +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/math.d.ts +12 -1
- package/utils/mobile.d.ts +2 -0
- package/utils/pointer.d.ts +4 -0
- package/utils/selected-element.d.ts +2 -2
package/fesm2022/plait-core.mjs
CHANGED
|
@@ -504,7 +504,7 @@ const PlaitNode = {
|
|
|
504
504
|
first(board, path) {
|
|
505
505
|
const p = path.slice();
|
|
506
506
|
let n = PlaitNode.get(board, p);
|
|
507
|
-
if (!n.children) {
|
|
507
|
+
if (!n.children || !board.isExpanded(n)) {
|
|
508
508
|
return n;
|
|
509
509
|
}
|
|
510
510
|
while (n) {
|
|
@@ -935,7 +935,7 @@ function getNearestPointBetweenPointAndEllipse(point, center, rx, ry, rotation =
|
|
|
935
935
|
let ty = 0.707;
|
|
936
936
|
const a = Math.abs(rectangleClient.width) / 2;
|
|
937
937
|
const b = Math.abs(rectangleClient.height) / 2;
|
|
938
|
-
[0, 1, 2, 3].forEach(x => {
|
|
938
|
+
[0, 1, 2, 3].forEach((x) => {
|
|
939
939
|
const xx = a * tx;
|
|
940
940
|
const yy = b * ty;
|
|
941
941
|
const ex = ((a * a - b * b) * tx ** 3) / a;
|
|
@@ -983,7 +983,7 @@ const isLineHitLine = (a, b, c, d) => {
|
|
|
983
983
|
const cd = [d[0] - c[0], d[1] - c[1]];
|
|
984
984
|
return crossProduct(ab, ac) * crossProduct(ab, ad) <= 0 && crossProduct(cd, ca) * crossProduct(cd, cb) <= 0;
|
|
985
985
|
};
|
|
986
|
-
const
|
|
986
|
+
const isLineHitRectangle = (points, rectangle, isClose = true) => {
|
|
987
987
|
const rectanglePoints = RectangleClient.getCornerPoints(rectangle);
|
|
988
988
|
const len = points.length;
|
|
989
989
|
for (let i = 0; i < len; i++) {
|
|
@@ -991,16 +991,34 @@ const isPolylineHitRectangle = (points, rectangle, isClose = true) => {
|
|
|
991
991
|
continue;
|
|
992
992
|
const p1 = points[i];
|
|
993
993
|
const p2 = points[(i + 1) % len];
|
|
994
|
-
const isHit =
|
|
995
|
-
isLineHitLine(p1, p2, rectanglePoints[1], rectanglePoints[2]) ||
|
|
996
|
-
isLineHitLine(p1, p2, rectanglePoints[2], rectanglePoints[3]) ||
|
|
997
|
-
isLineHitLine(p1, p2, rectanglePoints[3], rectanglePoints[0]);
|
|
994
|
+
const isHit = isSingleLineHitRectangleEdge(p1, p2, rectangle);
|
|
998
995
|
if (isHit || isPointInPolygon(p1, rectanglePoints) || isPointInPolygon(p2, rectanglePoints)) {
|
|
999
996
|
return true;
|
|
1000
997
|
}
|
|
1001
998
|
}
|
|
1002
999
|
return false;
|
|
1003
1000
|
};
|
|
1001
|
+
const isLineHitRectangleEdge = (points, rectangle, isClose = true) => {
|
|
1002
|
+
const len = points.length;
|
|
1003
|
+
for (let i = 0; i < len; i++) {
|
|
1004
|
+
if (i === len - 1 && !isClose)
|
|
1005
|
+
continue;
|
|
1006
|
+
const p1 = points[i];
|
|
1007
|
+
const p2 = points[(i + 1) % len];
|
|
1008
|
+
const isHit = isSingleLineHitRectangleEdge(p1, p2, rectangle);
|
|
1009
|
+
if (isHit) {
|
|
1010
|
+
return true;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
return false;
|
|
1014
|
+
};
|
|
1015
|
+
const isSingleLineHitRectangleEdge = (p1, p2, rectangle) => {
|
|
1016
|
+
const rectanglePoints = RectangleClient.getCornerPoints(rectangle);
|
|
1017
|
+
return (isLineHitLine(p1, p2, rectanglePoints[0], rectanglePoints[1]) ||
|
|
1018
|
+
isLineHitLine(p1, p2, rectanglePoints[1], rectanglePoints[2]) ||
|
|
1019
|
+
isLineHitLine(p1, p2, rectanglePoints[2], rectanglePoints[3]) ||
|
|
1020
|
+
isLineHitLine(p1, p2, rectanglePoints[3], rectanglePoints[0]));
|
|
1021
|
+
};
|
|
1004
1022
|
//https://stackoverflow.com/questions/22521982/check-if-point-is-inside-a-polygon
|
|
1005
1023
|
const isPointInPolygon = (point, points) => {
|
|
1006
1024
|
// ray-casting algorithm based on
|
|
@@ -1182,9 +1200,20 @@ function getCrossingPointsBetweenEllipseAndSegment(startPoint, endPoint, cx, cy,
|
|
|
1182
1200
|
}
|
|
1183
1201
|
return (tValues
|
|
1184
1202
|
// Filter to only points that are on the segment.
|
|
1185
|
-
.filter(t => !segment_only || (t >= 0 && t <= 1))
|
|
1203
|
+
.filter((t) => !segment_only || (t >= 0 && t <= 1))
|
|
1186
1204
|
// Solve for points.
|
|
1187
|
-
.map(t => [startPoint[0] + (endPoint[0] - startPoint[0]) * t + cx, startPoint[1] + (endPoint[1] - startPoint[1]) * t + cy]));
|
|
1205
|
+
.map((t) => [startPoint[0] + (endPoint[0] - startPoint[0]) * t + cx, startPoint[1] + (endPoint[1] - startPoint[1]) * t + cy]));
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Get a point between two points.
|
|
1209
|
+
* @param x0 The x-axis coordinate of the first point.
|
|
1210
|
+
* @param y0 The y-axis coordinate of the first point.
|
|
1211
|
+
* @param x1 The x-axis coordinate of the second point.
|
|
1212
|
+
* @param y1 The y-axis coordinate of the second point.
|
|
1213
|
+
* @param d Normalized
|
|
1214
|
+
*/
|
|
1215
|
+
function getPointBetween(x0, y0, x1, y1, d = 0.5) {
|
|
1216
|
+
return [x0 + (x1 - x0) * d, y0 + (y1 - y0) * d];
|
|
1188
1217
|
}
|
|
1189
1218
|
|
|
1190
1219
|
function isInPlaitBoard(board, x, y) {
|
|
@@ -1719,7 +1748,7 @@ const getHitElementsBySelection = (board, selection, match = () => true) => {
|
|
|
1719
1748
|
return [];
|
|
1720
1749
|
}
|
|
1721
1750
|
}
|
|
1722
|
-
depthFirstRecursion(board, node => {
|
|
1751
|
+
depthFirstRecursion(board, (node) => {
|
|
1723
1752
|
if (!PlaitBoard.isBoard(node) && match(node)) {
|
|
1724
1753
|
let isRectangleHit = false;
|
|
1725
1754
|
try {
|
|
@@ -1737,15 +1766,15 @@ const getHitElementsBySelection = (board, selection, match = () => true) => {
|
|
|
1737
1766
|
}, getIsRecursionFunc(board), true);
|
|
1738
1767
|
return rectangleHitElements;
|
|
1739
1768
|
};
|
|
1740
|
-
const getHitElementsByPoint = (board, point, match = () => true) => {
|
|
1769
|
+
const getHitElementsByPoint = (board, point, match = () => true, isStrict = true) => {
|
|
1741
1770
|
let hitElements = [];
|
|
1742
|
-
depthFirstRecursion(board, node => {
|
|
1771
|
+
depthFirstRecursion(board, (node) => {
|
|
1743
1772
|
if (PlaitBoard.isBoard(node) || !match(node) || !PlaitElement.hasMounted(node)) {
|
|
1744
1773
|
return;
|
|
1745
1774
|
}
|
|
1746
1775
|
let isHit = false;
|
|
1747
1776
|
try {
|
|
1748
|
-
isHit = board.isHit(node, point);
|
|
1777
|
+
isHit = board.isHit(node, point, isStrict);
|
|
1749
1778
|
}
|
|
1750
1779
|
catch (error) {
|
|
1751
1780
|
if (isDebug()) {
|
|
@@ -1759,8 +1788,8 @@ const getHitElementsByPoint = (board, point, match = () => true) => {
|
|
|
1759
1788
|
}, getIsRecursionFunc(board), true);
|
|
1760
1789
|
return hitElements;
|
|
1761
1790
|
};
|
|
1762
|
-
const getHitElementByPoint = (board, point, match = () => true) => {
|
|
1763
|
-
const pointHitElements = getHitElementsByPoint(board, point, match);
|
|
1791
|
+
const getHitElementByPoint = (board, point, match = () => true, isStrict = true) => {
|
|
1792
|
+
const pointHitElements = getHitElementsByPoint(board, point, match, isStrict);
|
|
1764
1793
|
const hitElement = board.getOneHitElement(pointHitElements);
|
|
1765
1794
|
return hitElement;
|
|
1766
1795
|
};
|
|
@@ -1798,14 +1827,14 @@ const removeSelectedElement = (board, element, isRemoveChildren = false) => {
|
|
|
1798
1827
|
if (selectedElements.includes(element)) {
|
|
1799
1828
|
const targetElements = [];
|
|
1800
1829
|
if (board.isRecursion(element) && isRemoveChildren) {
|
|
1801
|
-
depthFirstRecursion(element, node => {
|
|
1830
|
+
depthFirstRecursion(element, (node) => {
|
|
1802
1831
|
targetElements.push(node);
|
|
1803
|
-
}, node => board.isRecursion(node));
|
|
1832
|
+
}, (node) => board.isRecursion(node));
|
|
1804
1833
|
}
|
|
1805
1834
|
else {
|
|
1806
1835
|
targetElements.push(element);
|
|
1807
1836
|
}
|
|
1808
|
-
const newSelectedElements = selectedElements.filter(value => !targetElements.includes(value));
|
|
1837
|
+
const newSelectedElements = selectedElements.filter((value) => !targetElements.includes(value));
|
|
1809
1838
|
cacheSelectedElements(board, newSelectedElements);
|
|
1810
1839
|
}
|
|
1811
1840
|
};
|
|
@@ -1818,7 +1847,7 @@ const clearSelectedElement = (board) => {
|
|
|
1818
1847
|
};
|
|
1819
1848
|
const isSelectedElement = (board, element) => {
|
|
1820
1849
|
const selectedElements = getSelectedElements(board);
|
|
1821
|
-
return !!selectedElements.find(value => value === element);
|
|
1850
|
+
return !!selectedElements.find((value) => value === element);
|
|
1822
1851
|
};
|
|
1823
1852
|
const temporaryDisableSelection = (board) => {
|
|
1824
1853
|
const currentOptions = board.getPluginOptions(PlaitPluginKey.withSelection);
|
|
@@ -1968,15 +1997,14 @@ function updateViewport(board, origination, zoom) {
|
|
|
1968
1997
|
});
|
|
1969
1998
|
clearViewportOrigination(board);
|
|
1970
1999
|
}
|
|
1971
|
-
function updateZoom(board, newZoom,
|
|
2000
|
+
function updateZoom(board, newZoom, center) {
|
|
1972
2001
|
newZoom = clampZoomLevel(newZoom);
|
|
1973
|
-
const movingPoint = PlaitBoard.getMovingPointInBoard(board);
|
|
1974
2002
|
const nativeElement = PlaitBoard.getBoardContainer(board);
|
|
1975
2003
|
const nativeElementRect = nativeElement.getBoundingClientRect();
|
|
1976
2004
|
const boardContainerRect = PlaitBoard.getBoardContainer(board).getBoundingClientRect();
|
|
1977
2005
|
let focusPoint = [boardContainerRect.width / 2, boardContainerRect.height / 2];
|
|
1978
|
-
if (
|
|
1979
|
-
focusPoint = [
|
|
2006
|
+
if (center && distanceBetweenPointAndRectangle(center[0], center[1], nativeElementRect) === 0) {
|
|
2007
|
+
focusPoint = [center[0] - nativeElementRect.x, center[1] - nativeElementRect.y];
|
|
1980
2008
|
}
|
|
1981
2009
|
const zoom = board.viewport.zoom;
|
|
1982
2010
|
const origination = getViewportOrigination(board);
|
|
@@ -3639,6 +3667,19 @@ const getTargetIndex = (board, boundaryIndex, direction) => {
|
|
|
3639
3667
|
return candidateIndex;
|
|
3640
3668
|
};
|
|
3641
3669
|
|
|
3670
|
+
const isMobileDeviceEvent = (event) => {
|
|
3671
|
+
return isPencilEvent(event) || isTouchEvent(event);
|
|
3672
|
+
};
|
|
3673
|
+
const isPencilEvent = (event) => {
|
|
3674
|
+
return event.pointerType === 'pen';
|
|
3675
|
+
};
|
|
3676
|
+
const isTouchEvent = (event) => {
|
|
3677
|
+
return event.pointerType === 'touch';
|
|
3678
|
+
};
|
|
3679
|
+
const isMouseEvent = (event) => {
|
|
3680
|
+
return event.pointerType === 'mouse';
|
|
3681
|
+
};
|
|
3682
|
+
|
|
3642
3683
|
const addGroup = (board, elements) => {
|
|
3643
3684
|
const selectedGroups = getHighestSelectedGroups(board, elements);
|
|
3644
3685
|
const selectedIsolatedElements = getSelectedIsolatedElementsCanAddToGroup(board);
|
|
@@ -4997,6 +5038,7 @@ class ListRender {
|
|
|
4997
5038
|
if (diffResult) {
|
|
4998
5039
|
const newContexts = [];
|
|
4999
5040
|
const newInstances = [];
|
|
5041
|
+
// for moving scene: the current index for first element before moving
|
|
5000
5042
|
let currentIndexForFirstElement = null;
|
|
5001
5043
|
diffResult.forEachItem((record) => {
|
|
5002
5044
|
NODE_TO_INDEX.set(record.item, record.currentIndex);
|
|
@@ -5163,7 +5205,7 @@ currentIndexForFirstElement = null) => {
|
|
|
5163
5205
|
const mountOnItemMove = (element, index, childrenContext, currentIndexForFirstElement) => {
|
|
5164
5206
|
const containerG = PlaitElement.getContainerG(element, { suppressThrow: false });
|
|
5165
5207
|
mountElementG(index, containerG, childrenContext, currentIndexForFirstElement);
|
|
5166
|
-
if (element.children && !PlaitElement.isRootElement(element)) {
|
|
5208
|
+
if (element.children && !PlaitElement.isRootElement(element) && childrenContext.board.isExpanded(element)) {
|
|
5167
5209
|
element.children.forEach((child, index) => {
|
|
5168
5210
|
mountOnItemMove(child, index, { ...childrenContext, parent: element }, null);
|
|
5169
5211
|
});
|
|
@@ -5471,27 +5513,46 @@ function withBoard(board) {
|
|
|
5471
5513
|
return board;
|
|
5472
5514
|
}
|
|
5473
5515
|
|
|
5516
|
+
const isSmartHand = (board, event) => {
|
|
5517
|
+
return (PlaitBoard.isPointer(board, PlaitPointerType.hand) ||
|
|
5518
|
+
(PlaitBoard.isPointer(board, PlaitPointerType.selection) && isMobileDeviceEvent(event)));
|
|
5519
|
+
};
|
|
5520
|
+
|
|
5474
5521
|
function withHandPointer(board) {
|
|
5475
5522
|
const { pointerDown, pointerMove, globalPointerUp, keyDown, keyUp, pointerUp } = board;
|
|
5476
5523
|
let isMoving = false;
|
|
5477
5524
|
let movingPoint = null;
|
|
5525
|
+
let pointerDownEvent = null;
|
|
5478
5526
|
board.pointerDown = (event) => {
|
|
5479
5527
|
const options = board.getPluginOptions(PlaitPluginKey.withHand);
|
|
5480
|
-
if ((options?.isHandMode(board, event) ||
|
|
5528
|
+
if ((options?.isHandMode(board, event) || isSmartHand(board, event)) && isMainPointer(event)) {
|
|
5481
5529
|
movingPoint = {
|
|
5482
5530
|
x: event.x,
|
|
5483
5531
|
y: event.y
|
|
5484
5532
|
};
|
|
5485
5533
|
}
|
|
5534
|
+
pointerDownEvent = event;
|
|
5486
5535
|
pointerDown(event);
|
|
5487
5536
|
};
|
|
5488
5537
|
board.pointerMove = (event) => {
|
|
5489
5538
|
const options = board.getPluginOptions(PlaitPluginKey.withHand);
|
|
5490
|
-
|
|
5539
|
+
// 阈值必须大于 withSelection 中 pointerMove 的 PRESS_AND_MOVE_BUFFER:
|
|
5540
|
+
// 1. 首先检测是否满足进入拖选状态的条件
|
|
5541
|
+
// 2. 仅当不满足拖选条件时,才会考虑触发 withHand 行为
|
|
5542
|
+
// Must exceed the PRESS_AND_MOVE_BUFFER threshold defined in withSelection's pointerMove.
|
|
5543
|
+
// The system first checks for drag selection state eligibility
|
|
5544
|
+
// withHand behavior is only triggered if drag selection state is not initiated.
|
|
5545
|
+
const triggerDistance = PRESS_AND_MOVE_BUFFER + 3;
|
|
5546
|
+
if (movingPoint &&
|
|
5547
|
+
!isMoving &&
|
|
5548
|
+
!isSelectionMoving(board) &&
|
|
5549
|
+
pointerDownEvent &&
|
|
5550
|
+
distanceBetweenPointAndPoint(pointerDownEvent.x, pointerDownEvent.y, event.x, event.y) > triggerDistance &&
|
|
5551
|
+
!isMovingElements(board)) {
|
|
5491
5552
|
isMoving = true;
|
|
5492
5553
|
PlaitBoard.getBoardContainer(board).classList.add('viewport-moving');
|
|
5493
5554
|
}
|
|
5494
|
-
if ((options?.isHandMode(board, event) ||
|
|
5555
|
+
if ((options?.isHandMode(board, event) || isSmartHand(board, event)) && isMoving && movingPoint && !isSelectionMoving(board)) {
|
|
5495
5556
|
const viewportContainer = PlaitBoard.getViewportContainer(board);
|
|
5496
5557
|
const left = viewportContainer.scrollLeft - (event.x - movingPoint.x);
|
|
5497
5558
|
const top = viewportContainer.scrollTop - (event.y - movingPoint.y);
|
|
@@ -5691,7 +5752,7 @@ const withHotkey = (board) => {
|
|
|
5691
5752
|
if (PlaitBoard.getMovingPointInBoard(board) || PlaitBoard.isMovingPointInBoard(board)) {
|
|
5692
5753
|
if (isHotkey(['mod+=', 'mod++'], { byKey: true })(event)) {
|
|
5693
5754
|
event.preventDefault();
|
|
5694
|
-
BoardTransforms.updateZoom(board, board.viewport.zoom + 0.1
|
|
5755
|
+
BoardTransforms.updateZoom(board, board.viewport.zoom + 0.1);
|
|
5695
5756
|
return;
|
|
5696
5757
|
}
|
|
5697
5758
|
if (isHotkey(['mod+shift+=', 'mod+shift++'], { byKey: true })(event)) {
|
|
@@ -6220,6 +6281,8 @@ function withSelection(board) {
|
|
|
6220
6281
|
let selectionRectangleG;
|
|
6221
6282
|
let previousSelectedElements;
|
|
6222
6283
|
let isShift = false;
|
|
6284
|
+
let timerId = null;
|
|
6285
|
+
let pointerDownEvent = null;
|
|
6223
6286
|
board.pointerDown = (event) => {
|
|
6224
6287
|
if (!isShift && event.shiftKey) {
|
|
6225
6288
|
isShift = true;
|
|
@@ -6235,11 +6298,21 @@ function withSelection(board) {
|
|
|
6235
6298
|
options.isMultipleSelection &&
|
|
6236
6299
|
!options.isDisabledSelection) {
|
|
6237
6300
|
// start rectangle selection
|
|
6238
|
-
|
|
6301
|
+
timerId = setTimeout(() => {
|
|
6302
|
+
start = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
|
|
6303
|
+
timerId = null;
|
|
6304
|
+
}, 500);
|
|
6239
6305
|
}
|
|
6306
|
+
pointerDownEvent = event;
|
|
6240
6307
|
pointerDown(event);
|
|
6241
6308
|
};
|
|
6242
6309
|
board.pointerMove = (event) => {
|
|
6310
|
+
if (timerId &&
|
|
6311
|
+
pointerDownEvent &&
|
|
6312
|
+
distanceBetweenPointAndPoint(pointerDownEvent.x, pointerDownEvent.y, event.x, event.y) > PRESS_AND_MOVE_BUFFER) {
|
|
6313
|
+
clearTimeout(timerId);
|
|
6314
|
+
timerId = null;
|
|
6315
|
+
}
|
|
6243
6316
|
if (PlaitBoard.isPointer(board, PlaitPointerType.selection) && start) {
|
|
6244
6317
|
const movedTarget = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
|
|
6245
6318
|
const rectangle = RectangleClient.getRectangleByPoints([start, movedTarget]);
|
|
@@ -6303,7 +6376,7 @@ function withSelection(board) {
|
|
|
6303
6376
|
clearSelectedElement(board);
|
|
6304
6377
|
}
|
|
6305
6378
|
// remove selected element if include
|
|
6306
|
-
board.operations.forEach(op => {
|
|
6379
|
+
board.operations.forEach((op) => {
|
|
6307
6380
|
if (op.type === 'remove_node') {
|
|
6308
6381
|
removeSelectedElement(board, op.node, true);
|
|
6309
6382
|
}
|
|
@@ -6322,7 +6395,7 @@ function withSelection(board) {
|
|
|
6322
6395
|
if (!options.isMultipleSelection && elements.length > 1) {
|
|
6323
6396
|
elements = [elements[0]];
|
|
6324
6397
|
}
|
|
6325
|
-
const isHitElementWithGroup = elements.some(item => item.groupId);
|
|
6398
|
+
const isHitElementWithGroup = elements.some((item) => item.groupId);
|
|
6326
6399
|
const selectedElements = getSelectedElements(board);
|
|
6327
6400
|
if (isHitElementWithGroup) {
|
|
6328
6401
|
setSelectedElementsWithGroup(board, elements, isShift);
|
|
@@ -6337,7 +6410,7 @@ function withSelection(board) {
|
|
|
6337
6410
|
if (isShift) {
|
|
6338
6411
|
const newElements = [...selectedElements];
|
|
6339
6412
|
if (board.selection && Selection.isCollapsed(board.selection)) {
|
|
6340
|
-
elements.forEach(element => {
|
|
6413
|
+
elements.forEach((element) => {
|
|
6341
6414
|
if (newElements.includes(element)) {
|
|
6342
6415
|
newElements.splice(newElements.indexOf(element), 1);
|
|
6343
6416
|
}
|
|
@@ -6348,7 +6421,7 @@ function withSelection(board) {
|
|
|
6348
6421
|
cacheSelectedElements(board, newElements);
|
|
6349
6422
|
}
|
|
6350
6423
|
else {
|
|
6351
|
-
elements.forEach(element => {
|
|
6424
|
+
elements.forEach((element) => {
|
|
6352
6425
|
if (!newElements.includes(element)) {
|
|
6353
6426
|
newElements.push(element);
|
|
6354
6427
|
}
|
|
@@ -6606,5 +6679,5 @@ function createModModifierKeys() {
|
|
|
6606
6679
|
* Generated bundle index. Do not edit.
|
|
6607
6680
|
*/
|
|
6608
6681
|
|
|
6609
|
-
export { A, ACTIVE_MOVING_CLASS_NAME, ACTIVE_STROKE_WIDTH, ALT, APOSTROPHE, ATTACHED_ELEMENT_CLASS_NAME, AT_SIGN, B, BACKSLASH, BACKSPACE, BOARD_TO_AFTER_CHANGE, BOARD_TO_CONTEXT, BOARD_TO_ELEMENT_HOST, BOARD_TO_HOST, BOARD_TO_IS_SELECTION_MOVING, BOARD_TO_MOVING_ELEMENT, BOARD_TO_MOVING_POINT, BOARD_TO_MOVING_POINT_IN_BOARD, BOARD_TO_ON_CHANGE, BOARD_TO_ROUGH_SVG, BOARD_TO_SELECTED_ELEMENT, BOARD_TO_TEMPORARY_ELEMENTS, BOARD_TO_VIEWPORT_ORIGINATION, BoardTransforms, C, CAPS_LOCK, CLOSE_SQUARE_BRACKET, COMMA, CONTEXT_MENU, CONTROL, ColorfulThemeColor, CoreTransforms, CursorClass, D, DASH, DEFAULT_COLOR, DELETE, DOWN_ARROW, DarkThemeColor, DebugGenerator, DefaultThemeColor, Direction, E, EIGHT, ELEMENT_TO_REF, END, ENTER, EQUALS, ESCAPE, ElementFlavour, F, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, FF_EQUALS, FF_MINUS, FF_MUTE, FF_SEMICOLON, FF_VOLUME_DOWN, FF_VOLUME_UP, FIRST_MEDIA, FIVE, FLUSHING, FOUR, G, H, HISTORY, HIT_DISTANCE_BUFFER, HOME, HOST_CLASS_NAME, I, INSERT, IS_APPLE, IS_BOARD_ALIVE, IS_BOARD_CACHE, IS_CHROME, IS_CHROME_LEGACY, IS_DRAGGING, IS_EDGE_LEGACY, IS_FIREFOX, IS_IOS, IS_MAC, IS_SAFARI, IS_TEXT_EDITABLE, J, K, KEY_TO_ELEMENT_MAP, L, LAST_MEDIA, LEFT_ARROW, ListRender, M, MAC_ENTER, MAC_META, MAC_WK_CMD_LEFT, MAC_WK_CMD_RIGHT, MAX_RADIUS, MAX_ZOOM, MERGING, META, MIN_ZOOM, MUTE, N, NINE, NODE_TO_CONTAINER_G, NODE_TO_G, NODE_TO_INDEX, NODE_TO_PARENT, NS, NUMPAD_DIVIDE, NUMPAD_EIGHT, NUMPAD_FIVE, NUMPAD_FOUR, NUMPAD_MINUS, NUMPAD_MULTIPLY, NUMPAD_NINE, NUMPAD_ONE, NUMPAD_PERIOD, NUMPAD_PLUS, NUMPAD_SEVEN, NUMPAD_SIX, NUMPAD_THREE, NUMPAD_TWO, NUMPAD_ZERO, NUM_CENTER, NUM_LOCK, O, ONE, OPEN_SQUARE_BRACKET, P, PAGE_DOWN, PAGE_UP, PATH_REFS, PAUSE, PERIOD, PLUS_SIGN, POINTER_BUTTON, PRESS_AND_MOVE_BUFFER, PRINT_SCREEN, Path, PlaitBoard, PlaitBoardContext, PlaitElement, PlaitGroupElement, PlaitHistoryBoard, PlaitNode, PlaitOperation, PlaitPluginKey, PlaitPointerType, Point, Q, QUESTION_MARK, R, RESIZE_CURSORS, RESIZE_HANDLE_CLASS_NAME, RIGHT_ARROW, ROTATE_HANDLE_CLASS_NAME, RectangleClient, ResizeCursorClass, RetroThemeColor, RgbaToHEX, S, SAVING, SCROLL_BAR_WIDTH, SCROLL_LOCK, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, SELECTION_RECTANGLE_BOUNDING_CLASS_NAME, SELECTION_RECTANGLE_CLASS_NAME, SEMICOLON, SEVEN, SHIFT, SINGLE_QUOTE, SIX, SLASH, SNAPPING_STROKE_WIDTH, SNAP_TOLERANCE, SPACE, SPLITTING_ONCE, Selection, SoftThemeColor, StarryThemeColor, T, TAB, THREE, TILDE, TWO, ThemeColorMode, ThemeColors, Transforms, U, UP_ARROW, V, VOLUME_DOWN, VOLUME_UP, Viewport, W, WritableClipboardOperationType, WritableClipboardType, X, Y, Z, ZERO, ZOOM_STEP, addClipboardContext, addOrCreateClipboardContext, addSelectedElement, approximately, arrowPoints, buildPlaitHtml, cacheMovingElements, cacheSelectedElements, cacheSelectedElementsWithGroup, cacheSelectedElementsWithGroupOnShift, calcNewViewBox, canAddGroup, canRemoveGroup, canSetZIndex, catmullRomFitting, ceilToDecimal, clampZoomLevel, clearNodeWeakMap, clearSelectedElement, clearSelectionMoving, clearViewportOrigination, createBoard, createClipboardContext, createDebugGenerator, createFakeEvent, createForeignObject, createG, createGroup, createGroupRectangleG, createKeyboardEvent, createMask, createModModifierKeys, createMouseEvent, createPath, createPointerEvent, createRect, createSVG, createTestingBoard, createText, createTouchEvent, debounce, degreesToRadians, deleteFragment, deleteTemporaryElements, depthFirstRecursion, distanceBetweenPointAndPoint, distanceBetweenPointAndRectangle, distanceBetweenPointAndSegment, distanceBetweenPointAndSegments, downloadImage, drawArrow, drawBezierPath, drawCircle, drawDashedLines, drawLine, drawLinearPath, drawPendingNodesG, drawPointSnapLines, drawRectangle, drawRoundRectangle, drawSelectionRectangleG, drawSolidLines, duplicateElements, fakeNodeWeakMap, filterSelectedGroups, findElements, findIndex, findLastIndex, getAllElementsInGroup, getAllMoveOptions, getAngleBetweenPoints, getAngleByElement, getBarPoint, getBoardRectangle, getBoundingRectangleByElements, getClipboardData, getClipboardFromHtml, getCrossingPointsBetweenEllipseAndSegment, getDataTransferClipboard, getDataTransferClipboardText, getEditingGroup, getElementById, getElementHostBBox, getElementMap, getElementsInGroup, getElementsInGroupByElement, getElementsIndices, getEllipseTangentSlope, getGroupByElement, getHighestGroup, getHighestIndexOfElement, getHighestSelectedElements, getHighestSelectedGroup, getHighestSelectedGroups, getHitElementByPoint, getHitElementsByPoint, getHitElementsBySelection, getHitSelectedElements, getIsRecursionFunc, getMinPointDelta, getMovingElements, getNearestDelta, getNearestPointBetweenPointAndEllipse, getNearestPointBetweenPointAndSegment, getNearestPointBetweenPointAndSegments, getNearestPointRectangle, getOffsetAfterRotate, getOneMoveOptions, getProbablySupportsClipboardRead, getProbablySupportsClipboardWrite, getProbablySupportsClipboardWriteText, getRealScrollBarWidth, getRectangleByAngle, getRectangleByElements, getRectangleByGroup, getRotatedBoundingRectangle, getSelectedElements, getSelectedGroups, getSelectedIsolatedElements, getSelectedIsolatedElementsCanAddToGroup, getSelectedTargetElements, getSelectionAngle, getSelectionOptions, getSnapRectangles, getTemporaryElements, getTemporaryRef, getTripleAxis, getValidElements, getVectorFromPointAndSlope, getViewBox, getViewBoxCenterPoint, getViewportContainerRect, getViewportOrigination, hasBeforeContextChange, hasInputOrTextareaTarget, hasOnContextChanged, hasSameAngle, hasSelectedElementsInSameGroup, hasSetSelectionOperation, hasValidAngle, hotkeys, idCreator, initializeViewBox, initializeViewportContainer, initializeViewportOffset, inverse, isAxisChangedByAngle, isContextmenu, isDOMElement, isDOMNode, isDebug, isDragging, isFromScrolling, isFromViewportChange, isHandleSelection, isHitElement, isHitSelectedRectangle, isInPlaitBoard, isIndicesContinuous, isLineHitLine, isMainPointer, isMovingElements, isNullOrUndefined, isPointInEllipse, isPointInPolygon, isPointInRoundRectangle,
|
|
6682
|
+
export { A, ACTIVE_MOVING_CLASS_NAME, ACTIVE_STROKE_WIDTH, ALT, APOSTROPHE, ATTACHED_ELEMENT_CLASS_NAME, AT_SIGN, B, BACKSLASH, BACKSPACE, BOARD_TO_AFTER_CHANGE, BOARD_TO_CONTEXT, BOARD_TO_ELEMENT_HOST, BOARD_TO_HOST, BOARD_TO_IS_SELECTION_MOVING, BOARD_TO_MOVING_ELEMENT, BOARD_TO_MOVING_POINT, BOARD_TO_MOVING_POINT_IN_BOARD, BOARD_TO_ON_CHANGE, BOARD_TO_ROUGH_SVG, BOARD_TO_SELECTED_ELEMENT, BOARD_TO_TEMPORARY_ELEMENTS, BOARD_TO_VIEWPORT_ORIGINATION, BoardTransforms, C, CAPS_LOCK, CLOSE_SQUARE_BRACKET, COMMA, CONTEXT_MENU, CONTROL, ColorfulThemeColor, CoreTransforms, CursorClass, D, DASH, DEFAULT_COLOR, DELETE, DOWN_ARROW, DarkThemeColor, DebugGenerator, DefaultThemeColor, Direction, E, EIGHT, ELEMENT_TO_REF, END, ENTER, EQUALS, ESCAPE, ElementFlavour, F, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, FF_EQUALS, FF_MINUS, FF_MUTE, FF_SEMICOLON, FF_VOLUME_DOWN, FF_VOLUME_UP, FIRST_MEDIA, FIVE, FLUSHING, FOUR, G, H, HISTORY, HIT_DISTANCE_BUFFER, HOME, HOST_CLASS_NAME, I, INSERT, IS_APPLE, IS_BOARD_ALIVE, IS_BOARD_CACHE, IS_CHROME, IS_CHROME_LEGACY, IS_DRAGGING, IS_EDGE_LEGACY, IS_FIREFOX, IS_IOS, IS_MAC, IS_SAFARI, IS_TEXT_EDITABLE, J, K, KEY_TO_ELEMENT_MAP, L, LAST_MEDIA, LEFT_ARROW, ListRender, M, MAC_ENTER, MAC_META, MAC_WK_CMD_LEFT, MAC_WK_CMD_RIGHT, MAX_RADIUS, MAX_ZOOM, MERGING, META, MIN_ZOOM, MUTE, N, NINE, NODE_TO_CONTAINER_G, NODE_TO_G, NODE_TO_INDEX, NODE_TO_PARENT, NS, NUMPAD_DIVIDE, NUMPAD_EIGHT, NUMPAD_FIVE, NUMPAD_FOUR, NUMPAD_MINUS, NUMPAD_MULTIPLY, NUMPAD_NINE, NUMPAD_ONE, NUMPAD_PERIOD, NUMPAD_PLUS, NUMPAD_SEVEN, NUMPAD_SIX, NUMPAD_THREE, NUMPAD_TWO, NUMPAD_ZERO, NUM_CENTER, NUM_LOCK, O, ONE, OPEN_SQUARE_BRACKET, P, PAGE_DOWN, PAGE_UP, PATH_REFS, PAUSE, PERIOD, PLUS_SIGN, POINTER_BUTTON, PRESS_AND_MOVE_BUFFER, PRINT_SCREEN, Path, PlaitBoard, PlaitBoardContext, PlaitElement, PlaitGroupElement, PlaitHistoryBoard, PlaitNode, PlaitOperation, PlaitPluginKey, PlaitPointerType, Point, Q, QUESTION_MARK, R, RESIZE_CURSORS, RESIZE_HANDLE_CLASS_NAME, RIGHT_ARROW, ROTATE_HANDLE_CLASS_NAME, RectangleClient, ResizeCursorClass, RetroThemeColor, RgbaToHEX, S, SAVING, SCROLL_BAR_WIDTH, SCROLL_LOCK, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, SELECTION_RECTANGLE_BOUNDING_CLASS_NAME, SELECTION_RECTANGLE_CLASS_NAME, SEMICOLON, SEVEN, SHIFT, SINGLE_QUOTE, SIX, SLASH, SNAPPING_STROKE_WIDTH, SNAP_TOLERANCE, SPACE, SPLITTING_ONCE, Selection, SoftThemeColor, StarryThemeColor, T, TAB, THREE, TILDE, TWO, ThemeColorMode, ThemeColors, Transforms, U, UP_ARROW, V, VOLUME_DOWN, VOLUME_UP, Viewport, W, WritableClipboardOperationType, WritableClipboardType, X, Y, Z, ZERO, ZOOM_STEP, addClipboardContext, addOrCreateClipboardContext, addSelectedElement, approximately, arrowPoints, buildPlaitHtml, cacheMovingElements, cacheSelectedElements, cacheSelectedElementsWithGroup, cacheSelectedElementsWithGroupOnShift, calcNewViewBox, canAddGroup, canRemoveGroup, canSetZIndex, catmullRomFitting, ceilToDecimal, clampZoomLevel, clearNodeWeakMap, clearSelectedElement, clearSelectionMoving, clearViewportOrigination, createBoard, createClipboardContext, createDebugGenerator, createFakeEvent, createForeignObject, createG, createGroup, createGroupRectangleG, createKeyboardEvent, createMask, createModModifierKeys, createMouseEvent, createPath, createPointerEvent, createRect, createSVG, createTestingBoard, createText, createTouchEvent, debounce, degreesToRadians, deleteFragment, deleteTemporaryElements, depthFirstRecursion, distanceBetweenPointAndPoint, distanceBetweenPointAndRectangle, distanceBetweenPointAndSegment, distanceBetweenPointAndSegments, downloadImage, drawArrow, drawBezierPath, drawCircle, drawDashedLines, drawLine, drawLinearPath, drawPendingNodesG, drawPointSnapLines, drawRectangle, drawRoundRectangle, drawSelectionRectangleG, drawSolidLines, duplicateElements, fakeNodeWeakMap, filterSelectedGroups, findElements, findIndex, findLastIndex, getAllElementsInGroup, getAllMoveOptions, getAngleBetweenPoints, getAngleByElement, getBarPoint, getBoardRectangle, getBoundingRectangleByElements, getClipboardData, getClipboardFromHtml, getCrossingPointsBetweenEllipseAndSegment, getDataTransferClipboard, getDataTransferClipboardText, getEditingGroup, getElementById, getElementHostBBox, getElementMap, getElementsInGroup, getElementsInGroupByElement, getElementsIndices, getEllipseTangentSlope, getGroupByElement, getHighestGroup, getHighestIndexOfElement, getHighestSelectedElements, getHighestSelectedGroup, getHighestSelectedGroups, getHitElementByPoint, getHitElementsByPoint, getHitElementsBySelection, getHitSelectedElements, getIsRecursionFunc, getMinPointDelta, getMovingElements, getNearestDelta, getNearestPointBetweenPointAndEllipse, getNearestPointBetweenPointAndSegment, getNearestPointBetweenPointAndSegments, getNearestPointRectangle, getOffsetAfterRotate, getOneMoveOptions, getPointBetween, getProbablySupportsClipboardRead, getProbablySupportsClipboardWrite, getProbablySupportsClipboardWriteText, getRealScrollBarWidth, getRectangleByAngle, getRectangleByElements, getRectangleByGroup, getRotatedBoundingRectangle, getSelectedElements, getSelectedGroups, getSelectedIsolatedElements, getSelectedIsolatedElementsCanAddToGroup, getSelectedTargetElements, getSelectionAngle, getSelectionOptions, getSnapRectangles, getTemporaryElements, getTemporaryRef, getTripleAxis, getValidElements, getVectorFromPointAndSlope, getViewBox, getViewBoxCenterPoint, getViewportContainerRect, getViewportOrigination, hasBeforeContextChange, hasInputOrTextareaTarget, hasOnContextChanged, hasSameAngle, hasSelectedElementsInSameGroup, hasSetSelectionOperation, hasValidAngle, hotkeys, idCreator, initializeViewBox, initializeViewportContainer, initializeViewportOffset, inverse, isAxisChangedByAngle, isContextmenu, isDOMElement, isDOMNode, isDebug, isDragging, isFromScrolling, isFromViewportChange, isHandleSelection, isHitElement, isHitSelectedRectangle, isInPlaitBoard, isIndicesContinuous, isLineHitLine, isLineHitRectangle, isLineHitRectangleEdge, isMainPointer, isMobileDeviceEvent, isMouseEvent, isMovingElements, isNullOrUndefined, isPencilEvent, isPointInEllipse, isPointInPolygon, isPointInRoundRectangle, isSecondaryPointer, isSelectedAllElementsInGroup, isSelectedElement, isSelectedElementOrGroup, isSelectionMoving, isSetSelectionOperation, isSetThemeOperation, isSetViewportOperation, isSingleLineHitRectangleEdge, isSnapPoint, isTouchEvent, isValidAngle, mountElementG, moveElementsToNewPath, moveElementsToNewPathAfterAddGroup, nonGroupInHighestSelectedElements, normalizeAngle, normalizePoint, radiansToDegrees, removeMovingElements, removeSelectedElement, replaceAngleBrackets, replaceSelectedElement, reverseReplaceAngleBrackets, rotate, rotateAntiPointsByElement, rotateElements, rotatePoints, rotatePointsByAngle, rotatePointsByElement, rotatedDataPoints, scrollToRectangle, setAngleForG, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setDragging, setFragment, setIsFromScrolling, setIsFromViewportChange, setPathStrokeLinecap, setSVGViewBox, setSelectedElementsWithGroup, setSelectionMoving, setSelectionOptions, setStrokeLinecap, shouldClear, shouldMerge, shouldSave, sortElements, stripHtml, temporaryDisableSelection, throttleRAF, toDomPrecision, toFixed, toHostPoint, toHostPointFromViewBoxPoint, toImage, toScreenPointFromHostPoint, toViewBoxPoint, toViewBoxPoints, uniqueById, updateForeignObject, updateForeignObjectWidth, updatePoints, updateViewportByScrolling, updateViewportContainerScroll, updateViewportOffset, updateViewportOrigination, withArrowMoving, withBoard, withHandPointer, withHistory, withHotkey, withMoving, withOptions, withRelatedFragment, withSelection, withViewport };
|
|
6610
6683
|
//# sourceMappingURL=plait-core.mjs.map
|