@plait/draw 0.55.1 → 0.56.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.
Files changed (60) hide show
  1. package/constants/geometry.d.ts +69 -3
  2. package/engines/basic-shapes/ellipse.d.ts +8 -3
  3. package/engines/flowchart/database.d.ts +2 -0
  4. package/engines/flowchart/document.d.ts +2 -0
  5. package/engines/flowchart/hard-disk.d.ts +2 -0
  6. package/engines/flowchart/internal-storage.d.ts +2 -0
  7. package/engines/flowchart/multi-document.d.ts +4 -0
  8. package/engines/flowchart/note-curly-left.d.ts +2 -0
  9. package/engines/flowchart/note-curly-right.d.ts +2 -0
  10. package/engines/flowchart/note-square.d.ts +2 -0
  11. package/esm2022/constants/geometry.mjs +53 -7
  12. package/esm2022/engines/basic-shapes/ellipse.mjs +49 -36
  13. package/esm2022/engines/basic-shapes/pentagon-arrow.mjs +7 -4
  14. package/esm2022/engines/basic-shapes/process-arrow.mjs +5 -5
  15. package/esm2022/engines/basic-shapes/round-rectangle.mjs +2 -3
  16. package/esm2022/engines/flowchart/database.mjs +84 -0
  17. package/esm2022/engines/flowchart/delay.mjs +2 -3
  18. package/esm2022/engines/flowchart/document.mjs +81 -0
  19. package/esm2022/engines/flowchart/hard-disk.mjs +84 -0
  20. package/esm2022/engines/flowchart/internal-storage.mjs +47 -0
  21. package/esm2022/engines/flowchart/multi-document.mjs +143 -0
  22. package/esm2022/engines/flowchart/note-curly-left.mjs +50 -0
  23. package/esm2022/engines/flowchart/note-curly-right.mjs +50 -0
  24. package/esm2022/engines/flowchart/note-square.mjs +46 -0
  25. package/esm2022/engines/flowchart/or.mjs +2 -2
  26. package/esm2022/engines/flowchart/stored-data.mjs +2 -3
  27. package/esm2022/engines/flowchart/summing-junction.mjs +2 -2
  28. package/esm2022/engines/flowchart/terminal.mjs +2 -3
  29. package/esm2022/engines/index.mjs +18 -2
  30. package/esm2022/generators/line-active.generator.mjs +15 -13
  31. package/esm2022/generators/line-auto-complete.generator.mjs +2 -1
  32. package/esm2022/geometry.component.mjs +12 -20
  33. package/esm2022/image.component.mjs +8 -8
  34. package/esm2022/interfaces/geometry.mjs +9 -1
  35. package/esm2022/line.component.mjs +6 -6
  36. package/esm2022/plugins/with-draw-fragment.mjs +8 -8
  37. package/esm2022/plugins/with-draw-hotkey.mjs +5 -5
  38. package/esm2022/plugins/with-draw-rotate.mjs +6 -7
  39. package/esm2022/plugins/with-draw.mjs +3 -3
  40. package/esm2022/plugins/with-geometry-create.mjs +35 -22
  41. package/esm2022/plugins/with-geometry-resize.mjs +4 -5
  42. package/esm2022/plugins/with-line-auto-complete-reaction.mjs +6 -4
  43. package/esm2022/plugins/with-line-text-move.mjs +5 -5
  44. package/esm2022/plugins/with-line-text.mjs +11 -7
  45. package/esm2022/transforms/geometry.mjs +5 -3
  46. package/esm2022/utils/geometry.mjs +12 -8
  47. package/esm2022/utils/memorize.mjs +16 -3
  48. package/esm2022/utils/selected.mjs +4 -4
  49. package/fesm2022/plait-draw.mjs +756 -152
  50. package/fesm2022/plait-draw.mjs.map +1 -1
  51. package/generators/line-auto-complete.generator.d.ts +1 -0
  52. package/geometry.component.d.ts +1 -4
  53. package/image.component.d.ts +1 -3
  54. package/interfaces/geometry.d.ts +9 -1
  55. package/line.component.d.ts +1 -3
  56. package/package.json +1 -1
  57. package/utils/geometry.d.ts +21 -1
  58. package/utils/selected.d.ts +2 -2
  59. package/engines/basic-shapes/circle.d.ts +0 -8
  60. package/esm2022/engines/basic-shapes/circle.mjs +0 -51
@@ -1,5 +1,5 @@
1
- import { ACTIVE_STROKE_WIDTH, ThemeColorMode, createDebugGenerator, Point, RectangleClient, getElementById, rotatePointsByElement, createG, arrowPoints, createPath, distanceBetweenPointAndPoint, drawLinearPath, rotate, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPolylineHitRectangle, rotateAntiPointsByElement, rotatePoints, depthFirstRecursion, PlaitBoard, getIsRecursionFunc, idCreator, catmullRomFitting, setStrokeLinecap, findElements, createMask, createRect, getSelectedElements, isPointInPolygon, getNearestPointBetweenPointAndSegments, isPointInEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRectangle, drawRoundRectangle, isPointInRoundRectangle, setPathStrokeLinecap, getCrossingPointsBetweenEllipseAndSegment, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, Direction, hasValidAngle, Path, PlaitNode, toViewBoxPoint, toHostPoint, isSelectionMoving, RgbaToHEX, PlaitElement, getHitElementByPoint, getRectangleByElements, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, preventTouchMove, createClipboardContext, WritableClipboardType, addClipboardContext, setAngleForG, CursorClass, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER, isMainPointer, throttleRAF, getAngleBetweenPoints, degreesToRadians, normalizeAngle, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, SELECTION_RECTANGLE_CLASS_NAME } from '@plait/core';
2
- import { removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, getPointByVectorComponent, getExtendPoint, getUnitVectorByPointAndPoint, Generator, RESIZE_HANDLE_DIAMETER, getPointOnPolyline, TRANSPARENT, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, ROTATE_HANDLE_SIZE, getMemorizedLatest, memorizeLatest, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getDirectionByVector, getOppositeDirection, getDirectionFactor, rotateVector, getDirectionByPointOfRectangle, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, normalizeShapePoints, getFirstTextEditor, PRIMARY_COLOR, CommonPluginElement, ActiveGenerator, WithTextPluginKey, drawPrimaryHandle, drawFillPrimaryHandle, isVirtualKey, isDelete, isSpaceHotkey, isCornerHandle, getIndexByResizeHandle, resetPointsAfterResize, getFirstTextManage, withResize, drawHandle, getSymmetricHandleIndex, getResizeHandlePointByIndex, getDirectionFactorByDirectionComponent, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, isResizingByCondition, getRatioByPoint, ImageGenerator, ResizeHandle, addRotating, removeRotating, drawRotateHandle } from '@plait/common';
1
+ import { ACTIVE_STROKE_WIDTH, ThemeColorMode, createDebugGenerator, Point, RectangleClient, getElementById, rotatePointsByElement, createG, arrowPoints, createPath, distanceBetweenPointAndPoint, drawLinearPath, rotate, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPolylineHitRectangle, rotateAntiPointsByElement, rotatePoints, depthFirstRecursion, PlaitBoard, getIsRecursionFunc, idCreator, catmullRomFitting, setStrokeLinecap, findElements, createMask, createRect, getSelectedElements, isPointInPolygon, getNearestPointBetweenPointAndSegments, isPointInEllipse, getNearestPointBetweenPointAndEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRectangle, drawRoundRectangle, isPointInRoundRectangle, setPathStrokeLinecap, getCrossingPointsBetweenEllipseAndSegment, Direction, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, hasValidAngle, Path, PlaitNode, toViewBoxPoint, toHostPoint, isSelectionMoving, RgbaToHEX, getHitElementByPoint, getRectangleByElements, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, preventTouchMove, WritableClipboardOperationType, createClipboardContext, WritableClipboardType, addClipboardContext, setAngleForG, CursorClass, PlaitElement, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER, isMainPointer, throttleRAF, getAngleBetweenPoints, normalizeAngle, degreesToRadians, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, SELECTION_RECTANGLE_CLASS_NAME } from '@plait/core';
2
+ import { removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, getPointByVectorComponent, getExtendPoint, getUnitVectorByPointAndPoint, Generator, RESIZE_HANDLE_DIAMETER, getPointOnPolyline, TRANSPARENT, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, ROTATE_HANDLE_SIZE, getMemorizedLatest, memorizeLatest, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getDirectionByPointOfRectangle, getDirectionFactor, getFirstTextManage, getDirectionByVector, getOppositeDirection, rotateVector, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, normalizeShapePoints, getFirstTextEditor, PRIMARY_COLOR, CommonPluginElement, ActiveGenerator, canResize, WithTextPluginKey, drawPrimaryHandle, drawFillPrimaryHandle, isVirtualKey, isDelete, isSpaceHotkey, isCornerHandle, getIndexByResizeHandle, resetPointsAfterResize, withResize, drawHandle, getSymmetricHandleIndex, getResizeHandlePointByIndex, getDirectionFactorByDirectionComponent, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, isResizingByCondition, getRatioByPoint, getTextManages, ImageGenerator, ResizeHandle, addRotating, removeRotating, drawRotateHandle } from '@plait/common';
3
3
  import { Alignment, buildText, DEFAULT_FONT_SIZE, getTextSize, AlignEditor, TextManage } from '@plait/text';
4
4
  import { pointsOnBezierCurves } from 'points-on-curve';
5
5
  import * as i0 from '@angular/core';
@@ -49,6 +49,14 @@ var FlowchartSymbols;
49
49
  FlowchartSymbols["summingJunction"] = "summingJunction";
50
50
  FlowchartSymbols["predefinedProcess"] = "predefinedProcess";
51
51
  FlowchartSymbols["offPage"] = "offPage";
52
+ FlowchartSymbols["document"] = "document";
53
+ FlowchartSymbols["multiDocument"] = "multiDocument";
54
+ FlowchartSymbols["database"] = "database";
55
+ FlowchartSymbols["hardDisk"] = "hardDisk";
56
+ FlowchartSymbols["internalStorage"] = "internalStorage";
57
+ FlowchartSymbols["noteCurlyRight"] = "noteCurlyRight";
58
+ FlowchartSymbols["noteCurlyLeft"] = "noteCurlyLeft";
59
+ FlowchartSymbols["noteSquare"] = "noteSquare";
52
60
  })(FlowchartSymbols || (FlowchartSymbols = {}));
53
61
  const PlaitGeometry = {};
54
62
 
@@ -71,11 +79,21 @@ const DefaultBasicShapeProperty = {
71
79
  strokeColor: '#333',
72
80
  strokeWidth: 2
73
81
  };
74
- const DefaultCloudShapeProperty = {
82
+ const DefaultPentagonArrowProperty = {
75
83
  width: 120,
76
- height: 100,
77
- strokeColor: '#333',
78
- strokeWidth: 2
84
+ height: 50
85
+ };
86
+ const DefaultTwoWayArrowProperty = {
87
+ width: 138,
88
+ height: 80
89
+ };
90
+ const DefaultArrowProperty = {
91
+ width: 100,
92
+ height: 80
93
+ };
94
+ const DefaultCloudProperty = {
95
+ width: 120,
96
+ height: 100
79
97
  };
80
98
  const DefaultTextProperty = {
81
99
  width: 36,
@@ -93,6 +111,14 @@ const DefaultFlowchartProperty = {
93
111
  width: 120,
94
112
  height: 60
95
113
  };
114
+ const DefaultDataBaseProperty = {
115
+ width: 70,
116
+ height: 80
117
+ };
118
+ const DefaultInternalStorageProperty = {
119
+ width: 80,
120
+ height: 80
121
+ };
96
122
  const DefaultDecisionProperty = {
97
123
  width: 140,
98
124
  height: 70
@@ -101,6 +127,18 @@ const DefaultDataProperty = {
101
127
  width: 124,
102
128
  height: 60
103
129
  };
130
+ const DefaultDocumentProperty = {
131
+ width: 120,
132
+ height: 70
133
+ };
134
+ const DefaultNoteProperty = {
135
+ width: 160,
136
+ height: 100
137
+ };
138
+ const DefaultMultiDocumentProperty = {
139
+ width: 120,
140
+ height: 80
141
+ };
104
142
  const DefaultManualInputProperty = {
105
143
  width: 117,
106
144
  height: 59
@@ -109,6 +147,14 @@ const DefaultMergeProperty = {
109
147
  width: 47,
110
148
  height: 33
111
149
  };
150
+ const DefaultBasicShapePropertyMap = {
151
+ [BasicShapes.pentagonArrow]: DefaultPentagonArrowProperty,
152
+ [BasicShapes.processArrow]: DefaultPentagonArrowProperty,
153
+ [BasicShapes.cloud]: DefaultCloudProperty,
154
+ [BasicShapes.twoWayArrow]: DefaultTwoWayArrowProperty,
155
+ [BasicShapes.leftArrow]: DefaultArrowProperty,
156
+ [BasicShapes.rightArrow]: DefaultArrowProperty
157
+ };
112
158
  const DefaultFlowchartPropertyMap = {
113
159
  [FlowchartSymbols.connector]: DefaultConnectorProperty,
114
160
  [FlowchartSymbols.process]: DefaultFlowchartProperty,
@@ -124,7 +170,15 @@ const DefaultFlowchartPropertyMap = {
124
170
  [FlowchartSymbols.or]: DefaultConnectorProperty,
125
171
  [FlowchartSymbols.summingJunction]: DefaultConnectorProperty,
126
172
  [FlowchartSymbols.predefinedProcess]: DefaultFlowchartProperty,
127
- [FlowchartSymbols.offPage]: DefaultFlowchartProperty
173
+ [FlowchartSymbols.offPage]: DefaultFlowchartProperty,
174
+ [FlowchartSymbols.document]: DefaultDocumentProperty,
175
+ [FlowchartSymbols.multiDocument]: DefaultMultiDocumentProperty,
176
+ [FlowchartSymbols.database]: DefaultDataBaseProperty,
177
+ [FlowchartSymbols.hardDisk]: DefaultFlowchartProperty,
178
+ [FlowchartSymbols.internalStorage]: DefaultInternalStorageProperty,
179
+ [FlowchartSymbols.noteCurlyLeft]: DefaultNoteProperty,
180
+ [FlowchartSymbols.noteCurlyRight]: DefaultNoteProperty,
181
+ [FlowchartSymbols.noteSquare]: DefaultNoteProperty
128
182
  };
129
183
  const LINE_HIT_GEOMETRY_BUFFER = 10;
130
184
  const LINE_SNAPPING_BUFFER = 6;
@@ -1021,8 +1075,21 @@ const memorizeLatestText = (element, operations) => {
1021
1075
  let textMemory = getMemorizedLatest(memorizeKey)?.text || {};
1022
1076
  const setNodeOperation = operations.find(operation => operation.type === 'set_node');
1023
1077
  if (setNodeOperation) {
1024
- const newProperties = setNodeOperation.newProperties;
1025
- textMemory = { ...textMemory, ...newProperties };
1078
+ const { properties, newProperties } = setNodeOperation;
1079
+ for (const key in newProperties) {
1080
+ const value = newProperties[key];
1081
+ if (value == null) {
1082
+ delete textMemory[key];
1083
+ }
1084
+ else {
1085
+ textMemory[key] = value;
1086
+ }
1087
+ }
1088
+ for (const key in properties) {
1089
+ if (!newProperties.hasOwnProperty(key)) {
1090
+ delete textMemory[key];
1091
+ }
1092
+ }
1026
1093
  memorizeLatest(memorizeKey, 'text', textMemory);
1027
1094
  }
1028
1095
  };
@@ -1288,9 +1355,9 @@ function drawMask(board, element, id) {
1288
1355
  return { mask, maskTargetFillRect };
1289
1356
  }
1290
1357
 
1291
- const getSelectedDrawElements = (board) => {
1292
- const selectedElements = getSelectedElements(board).filter(value => PlaitDrawElement.isDrawElement(value));
1293
- return selectedElements;
1358
+ const getSelectedDrawElements = (board, elements) => {
1359
+ const selectedElements = elements?.length ? elements : getSelectedElements(board);
1360
+ return selectedElements.filter(value => PlaitDrawElement.isDrawElement(value));
1294
1361
  };
1295
1362
  const getSelectedGeometryElements = (board) => {
1296
1363
  const selectedElements = getSelectedElements(board).filter(value => PlaitDrawElement.isGeometry(value));
@@ -1530,43 +1597,7 @@ function createEllipseEngine(createOptions) {
1530
1597
  }
1531
1598
  return engine;
1532
1599
  }
1533
-
1534
1600
  const EllipseEngine = createEllipseEngine();
1535
- function getNearestPointBetweenPointAndEllipse(point, center, rx, ry, rotation = 0) {
1536
- const rectangleClient = {
1537
- x: center[0] - rx,
1538
- y: center[1] - ry,
1539
- height: ry * 2,
1540
- width: rx * 2
1541
- };
1542
- // https://stackoverflow.com/a/46007540/232122
1543
- const px = Math.abs(point[0] - rectangleClient.x - rectangleClient.width / 2);
1544
- const py = Math.abs(point[1] - rectangleClient.y - rectangleClient.height / 2);
1545
- let tx = 0.707;
1546
- let ty = 0.707;
1547
- const a = Math.abs(rectangleClient.width) / 2;
1548
- const b = Math.abs(rectangleClient.height) / 2;
1549
- [0, 1, 2, 3].forEach(x => {
1550
- const xx = a * tx;
1551
- const yy = b * ty;
1552
- const ex = ((a * a - b * b) * tx ** 3) / a;
1553
- const ey = ((b * b - a * a) * ty ** 3) / b;
1554
- const rx = xx - ex;
1555
- const ry = yy - ey;
1556
- const qx = px - ex;
1557
- const qy = py - ey;
1558
- const r = Math.hypot(ry, rx);
1559
- const q = Math.hypot(qy, qx);
1560
- tx = Math.min(1, Math.max(0, ((qx * r) / q + ex) / a));
1561
- ty = Math.min(1, Math.max(0, ((qy * r) / q + ey) / b));
1562
- const t = Math.hypot(ty, tx);
1563
- tx /= t;
1564
- ty /= t;
1565
- });
1566
- const signX = point[0] > center[0] ? 1 : -1;
1567
- const signY = point[1] > center[1] ? 1 : -1;
1568
- return [center[0] + a * tx * signX, center[1] + b * ty * signY];
1569
- }
1570
1601
 
1571
1602
  const getHexagonPoints = (rectangle) => {
1572
1603
  return [
@@ -1696,11 +1727,12 @@ const PentagonEngine = createPolygonEngine({
1696
1727
  });
1697
1728
 
1698
1729
  const getPentagonArrowPoints = (rectangle) => {
1730
+ const wider = rectangle.width > rectangle.height / 2;
1699
1731
  return [
1700
1732
  [rectangle.x, rectangle.y],
1701
- [rectangle.x + (rectangle.width * 3) / 5, rectangle.y],
1733
+ [rectangle.x + (wider ? rectangle.width - rectangle.height / 2 : 0), rectangle.y],
1702
1734
  [rectangle.x + rectangle.width, rectangle.y + rectangle.height / 2],
1703
- [rectangle.x + (rectangle.width * 3) / 5, rectangle.y + rectangle.height],
1735
+ [rectangle.x + (wider ? rectangle.width - rectangle.height / 2 : 0), rectangle.y + rectangle.height],
1704
1736
  [rectangle.x, rectangle.y + rectangle.height]
1705
1737
  ];
1706
1738
  };
@@ -1710,8 +1742,10 @@ const PentagonArrowEngine = createPolygonEngine({
1710
1742
  return RectangleClient.getEdgeCenterPoints(rectangle);
1711
1743
  },
1712
1744
  getTextRectangle(element) {
1745
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
1713
1746
  const rectangle = getTextRectangle(element);
1714
- rectangle.width = (rectangle.width * 3) / 5;
1747
+ const wider = elementRectangle.width > elementRectangle.height / 2 + 20;
1748
+ rectangle.width = wider ? elementRectangle.width - elementRectangle.height / 2 : rectangle.width;
1715
1749
  return rectangle;
1716
1750
  }
1717
1751
  });
@@ -1730,11 +1764,11 @@ const getProcessArrowPoints = (rectangle) => {
1730
1764
  const ProcessArrowEngine = createPolygonEngine({
1731
1765
  getPolygonPoints: getProcessArrowPoints,
1732
1766
  getTextRectangle(element) {
1733
- const rectangle = getTextRectangle(element);
1734
1767
  const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
1735
- const width = rectangle.width;
1736
- rectangle.width = elementRectangle.height / 2;
1737
- rectangle.x += elementRectangle.height / 2;
1768
+ const rectangle = getTextRectangle(element);
1769
+ const wider = elementRectangle.width > elementRectangle.height + 20;
1770
+ rectangle.width = wider ? elementRectangle.width - elementRectangle.height : rectangle.width;
1771
+ rectangle.x = wider ? elementRectangle.x + elementRectangle.height / 2 : rectangle.x;
1738
1772
  return rectangle;
1739
1773
  }
1740
1774
  });
@@ -2489,6 +2523,551 @@ const SummingJunctionEngine = createEllipseEngine({
2489
2523
  }
2490
2524
  });
2491
2525
 
2526
+ const DocumentEngine = {
2527
+ draw(board, rectangle, options) {
2528
+ const rs = PlaitBoard.getRoughSVG(board);
2529
+ const shape = rs.path(`M${rectangle.x} ${rectangle.y + rectangle.height - rectangle.height / 9} V${rectangle.y} H${rectangle.x +
2530
+ rectangle.width} V${rectangle.y + rectangle.height - rectangle.height / 9}
2531
+ Q${rectangle.x + rectangle.width - rectangle.width / 4} ${rectangle.y +
2532
+ rectangle.height -
2533
+ (rectangle.height / 9) * 3}, ${rectangle.x + rectangle.width / 2} ${rectangle.y +
2534
+ rectangle.height -
2535
+ rectangle.height / 9} T${rectangle.x} ${rectangle.y + rectangle.height - rectangle.height / 9}
2536
+ `, { ...options, fillStyle: 'solid' });
2537
+ setStrokeLinecap(shape, 'round');
2538
+ return shape;
2539
+ },
2540
+ isInsidePoint(rectangle, point) {
2541
+ const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2542
+ return RectangleClient.isHit(rectangle, rangeRectangle);
2543
+ },
2544
+ getCornerPoints(rectangle) {
2545
+ return RectangleClient.getCornerPoints(rectangle);
2546
+ },
2547
+ getNearestPoint(rectangle, point) {
2548
+ let nearestPoint = getNearestPointBetweenPointAndSegments(point, RectangleEngine.getCornerPoints(rectangle));
2549
+ let curvePoints = catmullRomFitting([
2550
+ [rectangle.x, rectangle.y + rectangle.height - rectangle.height / 9],
2551
+ [rectangle.x + rectangle.width / 4, rectangle.y + rectangle.height],
2552
+ [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height - rectangle.height / 9],
2553
+ [rectangle.x + (rectangle.width / 4) * 3, rectangle.y + rectangle.height - (rectangle.height / 9) * 2],
2554
+ [rectangle.x + rectangle.width, rectangle.y + rectangle.height - rectangle.height / 9]
2555
+ ]);
2556
+ curvePoints = pointsOnBezierCurves(curvePoints);
2557
+ if (nearestPoint[1] > rectangle.y + rectangle.height - rectangle.height / 9) {
2558
+ if (nearestPoint[0] === rectangle.x + rectangle.width / 2) {
2559
+ nearestPoint[1] = rectangle.y + rectangle.height - rectangle.height / 9;
2560
+ return nearestPoint;
2561
+ }
2562
+ nearestPoint = getNearestPointBetweenPointAndSegments(point, curvePoints, false);
2563
+ }
2564
+ return nearestPoint;
2565
+ },
2566
+ getConnectorPoints(rectangle) {
2567
+ return [
2568
+ [rectangle.x + rectangle.width / 2, rectangle.y],
2569
+ [rectangle.x + rectangle.width, rectangle.y + rectangle.height / 2],
2570
+ [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height - rectangle.height / 9],
2571
+ [rectangle.x, rectangle.y + rectangle.height / 2]
2572
+ ];
2573
+ },
2574
+ getTangentVectorByConnectionPoint(rectangle, pointOfRectangle) {
2575
+ const connectionPoint = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
2576
+ if (connectionPoint[0] > rectangle.x && connectionPoint[0] < rectangle.x + rectangle.width / 4) {
2577
+ return getUnitVectorByPointAndPoint([rectangle.x + rectangle.width / 4, rectangle.y + rectangle.height], connectionPoint);
2578
+ }
2579
+ if (connectionPoint[0] > rectangle.x + rectangle.width / 4 && connectionPoint[0] < rectangle.x + (rectangle.width / 4) * 3) {
2580
+ return getUnitVectorByPointAndPoint([rectangle.x + (rectangle.width / 4) * 3, rectangle.y + rectangle.height - rectangle.height / 9], [rectangle.x + rectangle.width / 4, rectangle.y + rectangle.height]);
2581
+ }
2582
+ if (connectionPoint[0] > rectangle.x + (rectangle.width / 4) * 3) {
2583
+ return getUnitVectorByPointAndPoint([rectangle.x + rectangle.width, rectangle.y + rectangle.height - rectangle.height / 9], connectionPoint);
2584
+ }
2585
+ return getUnitVectorByPointAndPoint(connectionPoint, [rectangle.x + rectangle.width / 4, rectangle.y + rectangle.height]);
2586
+ },
2587
+ getTextRectangle: (element) => {
2588
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
2589
+ const strokeWidth = getStrokeWidthByElement(element);
2590
+ const height = element.textHeight;
2591
+ const width = elementRectangle.width - ShapeDefaultSpace.rectangleAndText * 2 - strokeWidth * 2 - elementRectangle.width * 0.06 * 2;
2592
+ return {
2593
+ height,
2594
+ width: width > 0 ? width : 0,
2595
+ x: elementRectangle.x + ShapeDefaultSpace.rectangleAndText + strokeWidth + elementRectangle.width * 0.06,
2596
+ y: elementRectangle.y + (elementRectangle.height - height) / 2
2597
+ };
2598
+ }
2599
+ };
2600
+
2601
+ const getMultiDocumentPoints = (rectangle) => {
2602
+ const linePoints = [
2603
+ [rectangle.x, rectangle.y + 10],
2604
+ [rectangle.x + 5, rectangle.y + 10],
2605
+ [rectangle.x + 5, rectangle.y + 5],
2606
+ [rectangle.x + 10, rectangle.y + 5],
2607
+ [rectangle.x + 10, rectangle.y],
2608
+ [rectangle.x + rectangle.width, rectangle.y],
2609
+ [rectangle.x + rectangle.width, rectangle.y + rectangle.height - rectangle.height / 9 - 10 - 3],
2610
+ [rectangle.x + rectangle.width - 5, rectangle.y + rectangle.height - rectangle.height / 9 - 10 - 3 - 4],
2611
+ [rectangle.x + rectangle.width - 5, rectangle.y + rectangle.height - rectangle.height / 9 - 5 - 3],
2612
+ [rectangle.x + rectangle.width - 10, rectangle.y + rectangle.height - rectangle.height / 9 - 5 - 3 - 4],
2613
+ [rectangle.x + rectangle.width - 10, rectangle.y + rectangle.height - rectangle.height / 9]
2614
+ ];
2615
+ let curvePoints = catmullRomFitting([
2616
+ [rectangle.x + rectangle.width - 10, rectangle.y + rectangle.height - rectangle.height / 9],
2617
+ [rectangle.x + rectangle.width - 10 - (rectangle.width - 10) / 4, rectangle.y + rectangle.height - (rectangle.height / 9) * 2],
2618
+ [rectangle.x + (rectangle.width - 10) / 2, rectangle.y + rectangle.height - rectangle.height / 9],
2619
+ [rectangle.x + (rectangle.width - 10) / 4, rectangle.y + rectangle.height],
2620
+ [rectangle.x, rectangle.y + rectangle.height - rectangle.height / 9]
2621
+ ]);
2622
+ curvePoints = pointsOnBezierCurves(curvePoints);
2623
+ return [...linePoints, ...curvePoints];
2624
+ };
2625
+ const MultiDocumentEngine = {
2626
+ draw(board, rectangle, options) {
2627
+ const rs = PlaitBoard.getRoughSVG(board);
2628
+ const shape = rs.path(`M${rectangle.x} ${rectangle.y + rectangle.height - rectangle.height / 9} V${rectangle.y + 10} H${rectangle.x +
2629
+ 5} V${rectangle.y + 5} H${rectangle.x + 10} V${rectangle.y} H${rectangle.x + rectangle.width} V${rectangle.y +
2630
+ rectangle.height -
2631
+ rectangle.height / 9 -
2632
+ 10 -
2633
+ 3} L${rectangle.x + rectangle.width - 5} ${rectangle.y +
2634
+ rectangle.height -
2635
+ rectangle.height / 9 -
2636
+ 10 -
2637
+ 3 -
2638
+ 4} V${rectangle.y + rectangle.height - rectangle.height / 9 - 5 - 3}
2639
+ L${rectangle.x + rectangle.width - 10} ${rectangle.y +
2640
+ rectangle.height -
2641
+ rectangle.height / 9 -
2642
+ 5 -
2643
+ 3 -
2644
+ 4} V${rectangle.y + rectangle.height - rectangle.height / 9}
2645
+
2646
+ Q${rectangle.x + rectangle.width - 10 - (rectangle.width - 10) / 4} ${rectangle.y +
2647
+ rectangle.height -
2648
+ (rectangle.height / 9) * 3}, ${rectangle.x + (rectangle.width - 10) / 2} ${rectangle.y +
2649
+ rectangle.height -
2650
+ rectangle.height / 9} T${rectangle.x} ${rectangle.y + rectangle.height - rectangle.height / 9}
2651
+
2652
+ M${rectangle.x + 5} ${rectangle.y + 10} H${rectangle.x + rectangle.width - 10} V${rectangle.y +
2653
+ rectangle.height -
2654
+ rectangle.height / 9}
2655
+
2656
+ M${rectangle.x + 10} ${rectangle.y + 5} H${rectangle.x + rectangle.width - 5} V${rectangle.y +
2657
+ rectangle.height -
2658
+ rectangle.height / 9 -
2659
+ 10 -
2660
+ 3}
2661
+ `, { ...options, fillStyle: 'solid' });
2662
+ setStrokeLinecap(shape, 'round');
2663
+ return shape;
2664
+ },
2665
+ isInsidePoint(rectangle, point) {
2666
+ const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2667
+ return RectangleClient.isHit(rectangle, rangeRectangle);
2668
+ },
2669
+ getCornerPoints(rectangle) {
2670
+ return RectangleClient.getCornerPoints(rectangle);
2671
+ },
2672
+ getNearestPoint(rectangle, point) {
2673
+ return getNearestPointBetweenPointAndSegments(point, getMultiDocumentPoints(rectangle), false);
2674
+ },
2675
+ getConnectorPoints(rectangle) {
2676
+ let curvePoints = catmullRomFitting([
2677
+ [rectangle.x, rectangle.y + rectangle.height - rectangle.height / 9],
2678
+ [rectangle.x + (rectangle.width - 10) / 4, rectangle.y + rectangle.height],
2679
+ [rectangle.x + (rectangle.width - 10) / 2, rectangle.y + rectangle.height - rectangle.height / 9],
2680
+ [rectangle.x + ((rectangle.width - 10) / 4) * 3, rectangle.y + rectangle.height - (rectangle.height / 9) * 2],
2681
+ [rectangle.x + rectangle.width - 10, rectangle.y + rectangle.height - rectangle.height / 9]
2682
+ ]);
2683
+ curvePoints = pointsOnBezierCurves(curvePoints);
2684
+ const crossingPoint = getNearestPointBetweenPointAndSegments([rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height], curvePoints);
2685
+ return [
2686
+ [rectangle.x + rectangle.width / 2, rectangle.y],
2687
+ [rectangle.x + rectangle.width, rectangle.y + rectangle.height / 2],
2688
+ [crossingPoint[0], crossingPoint[1]],
2689
+ [rectangle.x, rectangle.y + rectangle.height / 2]
2690
+ ];
2691
+ },
2692
+ getNearestCrossingPoint(rectangle, point) {
2693
+ const crossingPoints = getCrossingPointBetweenPointAndPolygon(getMultiDocumentPoints(rectangle), point);
2694
+ let nearestPoint = crossingPoints[0];
2695
+ let nearestDistance = distanceBetweenPointAndPoint(point[0], point[1], nearestPoint[0], nearestPoint[1]);
2696
+ crossingPoints
2697
+ .filter((v, index) => index > 0)
2698
+ .forEach(crossingPoint => {
2699
+ let distance = distanceBetweenPointAndPoint(point[0], point[1], crossingPoint[0], crossingPoint[1]);
2700
+ if (distance < nearestDistance) {
2701
+ nearestDistance = distance;
2702
+ nearestPoint = crossingPoint;
2703
+ }
2704
+ });
2705
+ return nearestPoint;
2706
+ },
2707
+ getTangentVectorByConnectionPoint(rectangle, pointOfRectangle) {
2708
+ const connectionPoint = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
2709
+ if (connectionPoint[0] > rectangle.x && connectionPoint[0] < rectangle.x + (rectangle.width - 10) / 4) {
2710
+ return getUnitVectorByPointAndPoint([rectangle.x + (rectangle.width - 10) / 4, rectangle.y + rectangle.height], connectionPoint);
2711
+ }
2712
+ if (connectionPoint[0] > rectangle.x + (rectangle.width - 10) / 4 &&
2713
+ connectionPoint[0] < rectangle.x + ((rectangle.width - 10) / 4) * 3) {
2714
+ return getUnitVectorByPointAndPoint([rectangle.x + ((rectangle.width - 10) / 4) * 3, rectangle.y + rectangle.height - rectangle.height / 9], [rectangle.x + (rectangle.width - 10) / 4, rectangle.y + rectangle.height]);
2715
+ }
2716
+ if (connectionPoint[0] > rectangle.x + ((rectangle.width - 10) / 4) * 3 &&
2717
+ connectionPoint[0] < rectangle.x + rectangle.width - 10) {
2718
+ return getUnitVectorByPointAndPoint([rectangle.x + (rectangle.width - 10), rectangle.y + rectangle.height - rectangle.height / 9], connectionPoint);
2719
+ }
2720
+ const direction = getDirectionByPointOfRectangle(pointOfRectangle) || Direction.bottom;
2721
+ const factor = getDirectionFactor(direction);
2722
+ return [factor.x, factor.y];
2723
+ },
2724
+ getTextRectangle: (element) => {
2725
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
2726
+ const strokeWidth = getStrokeWidthByElement(element);
2727
+ const height = element.textHeight;
2728
+ const width = elementRectangle.width - ShapeDefaultSpace.rectangleAndText * 2 - strokeWidth * 2 - elementRectangle.width * 0.06 * 2;
2729
+ return {
2730
+ height,
2731
+ width: width > 0 ? width - 10 : 0,
2732
+ x: elementRectangle.x + ShapeDefaultSpace.rectangleAndText + strokeWidth + elementRectangle.width * 0.06,
2733
+ y: elementRectangle.y + (elementRectangle.height - height) / 2
2734
+ };
2735
+ }
2736
+ };
2737
+
2738
+ const DatabaseEngine = {
2739
+ draw(board, rectangle, options) {
2740
+ const rs = PlaitBoard.getRoughSVG(board);
2741
+ const shape = rs.path(`M${rectangle.x} ${rectangle.y + rectangle.height * 0.15}
2742
+ A${rectangle.width / 2} ${rectangle.height * 0.15}, 0, 0, 0,${rectangle.x + rectangle.width} ${rectangle.y +
2743
+ rectangle.height * 0.15}
2744
+ A${rectangle.width / 2} ${rectangle.height * 0.15}, 0, 0, 0,${rectangle.x} ${rectangle.y + rectangle.height * 0.15}
2745
+ V${rectangle.y + rectangle.height - rectangle.height * 0.15}
2746
+ A${rectangle.width / 2} ${rectangle.height * 0.15}, 0, 0, 0, ${rectangle.x + rectangle.width} ${rectangle.y +
2747
+ rectangle.height -
2748
+ rectangle.height * 0.15}
2749
+ V${rectangle.y + rectangle.height * 0.15}`, { ...options, fillStyle: 'solid' });
2750
+ setStrokeLinecap(shape, 'round');
2751
+ return shape;
2752
+ },
2753
+ isInsidePoint(rectangle, point) {
2754
+ const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2755
+ const isInRectangle = RectangleClient.isHit({
2756
+ ...rectangle,
2757
+ y: rectangle.y + rectangle.height * 0.15,
2758
+ height: rectangle.height - rectangle.height * 0.3
2759
+ }, rangeRectangle);
2760
+ const isInTopEllipse = isPointInEllipse(point, [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height * 0.15], rectangle.width / 2, rectangle.height * 0.15);
2761
+ const isInBottomEllipse = isPointInEllipse(point, [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height - rectangle.height * 0.15], rectangle.width / 2, rectangle.height * 0.15);
2762
+ return isInRectangle || isInTopEllipse || isInBottomEllipse;
2763
+ },
2764
+ getCornerPoints(rectangle) {
2765
+ return RectangleClient.getCornerPoints(rectangle);
2766
+ },
2767
+ getNearestPoint(rectangle, point) {
2768
+ const nearestPoint = getNearestPointBetweenPointAndSegments(point, RectangleEngine.getCornerPoints(rectangle));
2769
+ if (nearestPoint[1] < rectangle.y + rectangle.height * 0.15) {
2770
+ const centerPoint = [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height * 0.15];
2771
+ const nearestPoint = getNearestPointBetweenPointAndEllipse(point, centerPoint, rectangle.width / 2, rectangle.height * 0.15);
2772
+ if (nearestPoint[1] > centerPoint[1]) {
2773
+ nearestPoint[1] = centerPoint[1] * 2 - nearestPoint[1];
2774
+ }
2775
+ return nearestPoint;
2776
+ }
2777
+ if (nearestPoint[1] > rectangle.y + rectangle.height - rectangle.height * 0.15) {
2778
+ const centerPoint = [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height - rectangle.height * 0.15];
2779
+ const nearestPoint = getNearestPointBetweenPointAndEllipse(point, centerPoint, rectangle.width / 2, rectangle.height * 0.15);
2780
+ if (nearestPoint[1] < centerPoint[1]) {
2781
+ nearestPoint[1] = centerPoint[0] * 2 - nearestPoint[1];
2782
+ }
2783
+ return nearestPoint;
2784
+ }
2785
+ return nearestPoint;
2786
+ },
2787
+ getConnectorPoints(rectangle) {
2788
+ return RectangleClient.getEdgeCenterPoints(rectangle);
2789
+ },
2790
+ getTangentVectorByConnectionPoint(rectangle, pointOfRectangle) {
2791
+ const connectionPoint = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
2792
+ let centerPoint = [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height - rectangle.height * 0.15];
2793
+ let a = rectangle.width / 2;
2794
+ let b = rectangle.height * 0.15;
2795
+ const isInTopEllipse = connectionPoint[1] < rectangle.y + rectangle.height * 0.15 && connectionPoint[0] > rectangle.x;
2796
+ if (isInTopEllipse) {
2797
+ centerPoint = [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height * 0.15];
2798
+ }
2799
+ const point = [connectionPoint[0] - centerPoint[0], -(connectionPoint[1] - centerPoint[1])];
2800
+ const slope = getEllipseTangentSlope(point[0], point[1], a, b);
2801
+ const vector = getVectorFromPointAndSlope(point[0], point[1], slope);
2802
+ return vector;
2803
+ },
2804
+ getTextRectangle: (element) => {
2805
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
2806
+ const strokeWidth = getStrokeWidthByElement(element);
2807
+ const height = element.textHeight;
2808
+ const width = elementRectangle.width - ShapeDefaultSpace.rectangleAndText * 2 - strokeWidth * 2;
2809
+ return {
2810
+ height,
2811
+ width: width > 0 ? width : 0,
2812
+ x: elementRectangle.x + ShapeDefaultSpace.rectangleAndText + strokeWidth,
2813
+ y: elementRectangle.y + elementRectangle.height * 0.3 + (elementRectangle.height - elementRectangle.height * 0.45 - height) / 2
2814
+ };
2815
+ }
2816
+ };
2817
+
2818
+ const HardDiskEngine = {
2819
+ draw(board, rectangle, options) {
2820
+ const rs = PlaitBoard.getRoughSVG(board);
2821
+ const shape = rs.path(`M${rectangle.x + rectangle.width - rectangle.width * 0.15} ${rectangle.y}
2822
+ A${rectangle.width * 0.15} ${rectangle.height / 2}, 0, 0, 0,${rectangle.x +
2823
+ rectangle.width -
2824
+ rectangle.width * 0.15} ${rectangle.y + rectangle.height}
2825
+ A${rectangle.width * 0.15} ${rectangle.height / 2}, 0, 0, 0,${rectangle.x + rectangle.width - rectangle.width * 0.15} ${rectangle.y}
2826
+ H${rectangle.x + rectangle.width * 0.15}
2827
+ A${rectangle.width * 0.15} ${rectangle.height / 2}, 0, 0, 0, ${rectangle.x + rectangle.width * 0.15} ${rectangle.y +
2828
+ rectangle.height}
2829
+ H${rectangle.x + rectangle.width - rectangle.width * 0.15}`, { ...options, fillStyle: 'solid' });
2830
+ setStrokeLinecap(shape, 'round');
2831
+ return shape;
2832
+ },
2833
+ isInsidePoint(rectangle, point) {
2834
+ const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2835
+ const isInRectangle = RectangleClient.isHit({
2836
+ ...rectangle,
2837
+ x: rectangle.x + rectangle.width * 0.15,
2838
+ width: rectangle.width - rectangle.width * 0.3
2839
+ }, rangeRectangle);
2840
+ const isInLeftEllipse = isPointInEllipse(point, [rectangle.x + rectangle.width * 0.15, rectangle.y + rectangle.height / 2], rectangle.width * 0.15, rectangle.height / 2);
2841
+ const isInRightEllipse = isPointInEllipse(point, [rectangle.x + rectangle.width - rectangle.width * 0.15, rectangle.y + rectangle.height / 2], rectangle.width * 0.15, rectangle.height / 2);
2842
+ return isInRectangle || isInLeftEllipse || isInRightEllipse;
2843
+ },
2844
+ getCornerPoints(rectangle) {
2845
+ return RectangleClient.getCornerPoints(rectangle);
2846
+ },
2847
+ getNearestPoint(rectangle, point) {
2848
+ const nearestPoint = getNearestPointBetweenPointAndSegments(point, RectangleEngine.getCornerPoints(rectangle));
2849
+ if (nearestPoint[0] < rectangle.x + rectangle.width * 0.15) {
2850
+ const centerPoint = [rectangle.x + rectangle.width * 0.15, rectangle.y + rectangle.height / 2];
2851
+ const nearestPoint = getNearestPointBetweenPointAndEllipse(point, centerPoint, rectangle.width * 0.15, rectangle.height / 2);
2852
+ if (nearestPoint[0] > centerPoint[0]) {
2853
+ nearestPoint[0] = centerPoint[0] * 2 - nearestPoint[0];
2854
+ }
2855
+ return nearestPoint;
2856
+ }
2857
+ if (nearestPoint[0] > rectangle.x + rectangle.width - rectangle.width * 0.15) {
2858
+ const centerPoint = [rectangle.x + rectangle.width - rectangle.width * 0.15, rectangle.y + rectangle.height / 2];
2859
+ const nearestPoint = getNearestPointBetweenPointAndEllipse(point, centerPoint, rectangle.width * 0.15, rectangle.height / 2);
2860
+ if (nearestPoint[0] < centerPoint[0]) {
2861
+ nearestPoint[0] = centerPoint[0] * 2 - nearestPoint[0];
2862
+ }
2863
+ return nearestPoint;
2864
+ }
2865
+ return nearestPoint;
2866
+ },
2867
+ getConnectorPoints(rectangle) {
2868
+ return RectangleClient.getEdgeCenterPoints(rectangle);
2869
+ },
2870
+ getTangentVectorByConnectionPoint(rectangle, pointOfRectangle) {
2871
+ const connectionPoint = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
2872
+ let centerPoint = [rectangle.x + rectangle.width * 0.15, rectangle.y + rectangle.height / 2];
2873
+ let a = rectangle.width * 0.15;
2874
+ let b = rectangle.height / 2;
2875
+ const isInRightEllipse = connectionPoint[0] > rectangle.x + rectangle.width - rectangle.width * 0.15 && connectionPoint[1] > rectangle.y;
2876
+ if (isInRightEllipse) {
2877
+ centerPoint = [rectangle.x + rectangle.width - rectangle.width * 0.15, rectangle.y + rectangle.height / 2];
2878
+ }
2879
+ const point = [connectionPoint[0] - centerPoint[0], -(connectionPoint[1] - centerPoint[1])];
2880
+ const slope = getEllipseTangentSlope(point[0], point[1], a, b);
2881
+ const vector = getVectorFromPointAndSlope(point[0], point[1], slope);
2882
+ return vector;
2883
+ },
2884
+ getTextRectangle: (element) => {
2885
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
2886
+ const strokeWidth = getStrokeWidthByElement(element);
2887
+ const height = element.textHeight;
2888
+ const width = elementRectangle.width - elementRectangle.width * 0.45 - ShapeDefaultSpace.rectangleAndText * 2 - strokeWidth * 2;
2889
+ return {
2890
+ height,
2891
+ width: width > 0 ? width : 0,
2892
+ x: elementRectangle.x + elementRectangle.width * 0.15 + ShapeDefaultSpace.rectangleAndText + strokeWidth,
2893
+ y: elementRectangle.y + (elementRectangle.height - height) / 2
2894
+ };
2895
+ }
2896
+ };
2897
+
2898
+ const InternalStorageEngine = {
2899
+ draw(board, rectangle, options) {
2900
+ const rs = PlaitBoard.getRoughSVG(board);
2901
+ const shape = rs.path(`M${rectangle.x} ${rectangle.y} h${rectangle.width} v${rectangle.height} h${-rectangle.width} v${-rectangle.height}
2902
+ M${rectangle.x} ${rectangle.y + rectangle.height / 10} h${rectangle.width}
2903
+ M${rectangle.x + rectangle.width / 10} ${rectangle.y} v${rectangle.height}
2904
+ `, { ...options, fillStyle: 'solid' });
2905
+ setStrokeLinecap(shape, 'round');
2906
+ return shape;
2907
+ },
2908
+ isInsidePoint(rectangle, point) {
2909
+ const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2910
+ return RectangleClient.isHit(rectangle, rangeRectangle);
2911
+ },
2912
+ getCornerPoints(rectangle) {
2913
+ return RectangleClient.getCornerPoints(rectangle);
2914
+ },
2915
+ getNearestPoint(rectangle, point) {
2916
+ return getNearestPointBetweenPointAndSegments(point, RectangleEngine.getCornerPoints(rectangle));
2917
+ },
2918
+ getEdgeByConnectionPoint(rectangle, pointOfRectangle) {
2919
+ const corners = RectangleEngine.getCornerPoints(rectangle);
2920
+ const point = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
2921
+ return getPolygonEdgeByConnectionPoint(corners, point);
2922
+ },
2923
+ getConnectorPoints(rectangle) {
2924
+ return RectangleClient.getEdgeCenterPoints(rectangle);
2925
+ },
2926
+ getTextRectangle: (element) => {
2927
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
2928
+ const strokeWidth = getStrokeWidthByElement(element);
2929
+ const height = element.textHeight;
2930
+ const width = elementRectangle.width - elementRectangle.width * 0.1 - ShapeDefaultSpace.rectangleAndText * 2 - strokeWidth * 2;
2931
+ return {
2932
+ height,
2933
+ width: width > 0 ? width : 0,
2934
+ x: elementRectangle.x + elementRectangle.width * 0.1 + ShapeDefaultSpace.rectangleAndText + strokeWidth,
2935
+ y: elementRectangle.y + elementRectangle.height * 0.1 + (elementRectangle.height - elementRectangle.height * 0.1 - height) / 2
2936
+ };
2937
+ }
2938
+ };
2939
+
2940
+ const NoteCurlyLeftEngine = {
2941
+ draw(board, rectangle, options) {
2942
+ const rs = PlaitBoard.getRoughSVG(board);
2943
+ const shape = rs.path(`M${rectangle.x + rectangle.width} ${rectangle.y}
2944
+ C${rectangle.x + rectangle.width - rectangle.width * 0.09} ${rectangle.y},
2945
+ ${rectangle.x + rectangle.width} ${rectangle.y + rectangle.height / 2},
2946
+ ${rectangle.x + rectangle.width - rectangle.width * 0.09} ${rectangle.y + rectangle.height / 2}
2947
+ C${rectangle.x + rectangle.width} ${rectangle.y + rectangle.height / 2},
2948
+ ${rectangle.x + rectangle.width - rectangle.width * 0.09} ${rectangle.y + rectangle.height},
2949
+ ${rectangle.x + rectangle.width} ${rectangle.y + rectangle.height}`, { ...options, fillStyle: 'solid' });
2950
+ setStrokeLinecap(shape, 'round');
2951
+ return shape;
2952
+ },
2953
+ isInsidePoint(rectangle, point) {
2954
+ const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2955
+ return RectangleClient.isHit(rectangle, rangeRectangle);
2956
+ },
2957
+ getCornerPoints(rectangle) {
2958
+ return RectangleClient.getCornerPoints(rectangle);
2959
+ },
2960
+ getNearestPoint(rectangle, point) {
2961
+ return getNearestPointBetweenPointAndSegments(point, RectangleEngine.getCornerPoints(rectangle));
2962
+ },
2963
+ getEdgeByConnectionPoint(rectangle, pointOfRectangle) {
2964
+ const corners = RectangleEngine.getCornerPoints(rectangle);
2965
+ const point = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
2966
+ return getPolygonEdgeByConnectionPoint(corners, point);
2967
+ },
2968
+ getConnectorPoints(rectangle) {
2969
+ return RectangleClient.getEdgeCenterPoints(rectangle);
2970
+ },
2971
+ getTextRectangle: (element) => {
2972
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
2973
+ const strokeWidth = getStrokeWidthByElement(element);
2974
+ const height = element.textHeight;
2975
+ const width = elementRectangle.width - elementRectangle.width * 0.09 - ShapeDefaultSpace.rectangleAndText * 2 - strokeWidth * 2;
2976
+ return {
2977
+ height,
2978
+ width: width > 0 ? width : 0,
2979
+ x: elementRectangle.x + ShapeDefaultSpace.rectangleAndText + strokeWidth,
2980
+ y: elementRectangle.y + (elementRectangle.height - height) / 2
2981
+ };
2982
+ }
2983
+ };
2984
+
2985
+ const NoteCurlyRightEngine = {
2986
+ draw(board, rectangle, options) {
2987
+ const rs = PlaitBoard.getRoughSVG(board);
2988
+ const shape = rs.path(`M${rectangle.x} ${rectangle.y}
2989
+ C${rectangle.x + rectangle.width * 0.09} ${rectangle.y},
2990
+ ${rectangle.x} ${rectangle.y + rectangle.height / 2},
2991
+ ${rectangle.x + rectangle.width * 0.09} ${rectangle.y + rectangle.height / 2}
2992
+ C${rectangle.x} ${rectangle.y + rectangle.height / 2},
2993
+ ${rectangle.x + rectangle.width * 0.09} ${rectangle.y + rectangle.height},
2994
+ ${rectangle.x} ${rectangle.y + rectangle.height}`, { ...options, fillStyle: 'solid' });
2995
+ setStrokeLinecap(shape, 'round');
2996
+ return shape;
2997
+ },
2998
+ isInsidePoint(rectangle, point) {
2999
+ const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
3000
+ return RectangleClient.isHit(rectangle, rangeRectangle);
3001
+ },
3002
+ getCornerPoints(rectangle) {
3003
+ return RectangleClient.getCornerPoints(rectangle);
3004
+ },
3005
+ getNearestPoint(rectangle, point) {
3006
+ return getNearestPointBetweenPointAndSegments(point, RectangleEngine.getCornerPoints(rectangle));
3007
+ },
3008
+ getEdgeByConnectionPoint(rectangle, pointOfRectangle) {
3009
+ const corners = RectangleEngine.getCornerPoints(rectangle);
3010
+ const point = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
3011
+ return getPolygonEdgeByConnectionPoint(corners, point);
3012
+ },
3013
+ getConnectorPoints(rectangle) {
3014
+ return RectangleClient.getEdgeCenterPoints(rectangle);
3015
+ },
3016
+ getTextRectangle: (element) => {
3017
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
3018
+ const strokeWidth = getStrokeWidthByElement(element);
3019
+ const height = element.textHeight;
3020
+ const width = elementRectangle.width - elementRectangle.width * 0.09 - ShapeDefaultSpace.rectangleAndText * 2 - strokeWidth * 2;
3021
+ return {
3022
+ height,
3023
+ width: width > 0 ? width : 0,
3024
+ x: elementRectangle.x + elementRectangle.width * 0.09 + ShapeDefaultSpace.rectangleAndText + strokeWidth,
3025
+ y: elementRectangle.y + (elementRectangle.height - height) / 2
3026
+ };
3027
+ }
3028
+ };
3029
+
3030
+ const NoteSquareEngine = {
3031
+ draw(board, rectangle, options) {
3032
+ const rs = PlaitBoard.getRoughSVG(board);
3033
+ const shape = rs.path(`M${rectangle.x + rectangle.width * 0.075} ${rectangle.y + rectangle.height} H${rectangle.x} V${rectangle.y} H${rectangle.x +
3034
+ rectangle.width * 0.075}
3035
+ `, { ...options, fillStyle: 'solid' });
3036
+ setStrokeLinecap(shape, 'round');
3037
+ return shape;
3038
+ },
3039
+ isInsidePoint(rectangle, point) {
3040
+ const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
3041
+ return RectangleClient.isHit(rectangle, rangeRectangle);
3042
+ },
3043
+ getCornerPoints(rectangle) {
3044
+ return RectangleClient.getCornerPoints(rectangle);
3045
+ },
3046
+ getNearestPoint(rectangle, point) {
3047
+ return getNearestPointBetweenPointAndSegments(point, RectangleEngine.getCornerPoints(rectangle));
3048
+ },
3049
+ getEdgeByConnectionPoint(rectangle, pointOfRectangle) {
3050
+ const corners = RectangleEngine.getCornerPoints(rectangle);
3051
+ const point = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
3052
+ return getPolygonEdgeByConnectionPoint(corners, point);
3053
+ },
3054
+ getConnectorPoints(rectangle) {
3055
+ return RectangleClient.getEdgeCenterPoints(rectangle);
3056
+ },
3057
+ getTextRectangle: (element) => {
3058
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
3059
+ const strokeWidth = getStrokeWidthByElement(element);
3060
+ const height = element.textHeight;
3061
+ const width = elementRectangle.width - ShapeDefaultSpace.rectangleAndText * 2 - strokeWidth * 2;
3062
+ return {
3063
+ height,
3064
+ width: width > 0 ? width : 0,
3065
+ x: elementRectangle.x + ShapeDefaultSpace.rectangleAndText + strokeWidth,
3066
+ y: elementRectangle.y + (elementRectangle.height - height) / 2
3067
+ };
3068
+ }
3069
+ };
3070
+
2492
3071
  const ShapeEngineMap = {
2493
3072
  [BasicShapes.rectangle]: RectangleEngine,
2494
3073
  [BasicShapes.diamond]: DiamondEngine,
@@ -2516,6 +3095,9 @@ const ShapeEngineMap = {
2516
3095
  [FlowchartSymbols.connector]: EllipseEngine,
2517
3096
  [FlowchartSymbols.data]: ParallelogramEngine,
2518
3097
  [FlowchartSymbols.terminal]: TerminalEngine,
3098
+ [FlowchartSymbols.database]: DatabaseEngine,
3099
+ [FlowchartSymbols.hardDisk]: HardDiskEngine,
3100
+ [FlowchartSymbols.internalStorage]: InternalStorageEngine,
2519
3101
  [FlowchartSymbols.manualInput]: ManualInputEngine,
2520
3102
  [FlowchartSymbols.preparation]: PreparationEngine,
2521
3103
  [FlowchartSymbols.manualLoop]: ManualLoopEngine,
@@ -2525,7 +3107,12 @@ const ShapeEngineMap = {
2525
3107
  [FlowchartSymbols.or]: OrEngine,
2526
3108
  [FlowchartSymbols.summingJunction]: SummingJunctionEngine,
2527
3109
  [FlowchartSymbols.predefinedProcess]: PredefinedProcessEngine,
2528
- [FlowchartSymbols.offPage]: OffPageEngine
3110
+ [FlowchartSymbols.offPage]: OffPageEngine,
3111
+ [FlowchartSymbols.document]: DocumentEngine,
3112
+ [FlowchartSymbols.multiDocument]: MultiDocumentEngine,
3113
+ [FlowchartSymbols.noteCurlyLeft]: NoteCurlyLeftEngine,
3114
+ [FlowchartSymbols.noteCurlyRight]: NoteCurlyRightEngine,
3115
+ [FlowchartSymbols.noteSquare]: NoteSquareEngine
2529
3116
  };
2530
3117
  const getEngine = (shape) => {
2531
3118
  return ShapeEngineMap[shape];
@@ -2621,6 +3208,9 @@ const getCenterPointsOnPolygon = (points) => {
2621
3208
  const getDefaultFlowchartProperty = (symbol) => {
2622
3209
  return DefaultFlowchartPropertyMap[symbol];
2623
3210
  };
3211
+ const getDefaultBasicShapeProperty = (shape) => {
3212
+ return DefaultBasicShapePropertyMap[shape] || DefaultBasicShapeProperty;
3213
+ };
2624
3214
  const createDefaultFlowchart = (point) => {
2625
3215
  const decisionProperty = getDefaultFlowchartProperty(FlowchartSymbols.decision);
2626
3216
  const processProperty = getDefaultFlowchartProperty(FlowchartSymbols.process);
@@ -2635,7 +3225,7 @@ const createDefaultFlowchart = (point) => {
2635
3225
  const processPoint1 = [point[0], point[1] + terminalProperty.height / 2 + 55 + processProperty.height / 2];
2636
3226
  const processElement1 = createGeometryElement(FlowchartSymbols.process, getDefaultGeometryPoints(FlowchartSymbols.process, processPoint1), '过程', options);
2637
3227
  const decisionPoint = [processPoint1[0], processPoint1[1] + processProperty.height / 2 + 55 + decisionProperty.height / 2];
2638
- const decisionElement = createGeometryElement(FlowchartSymbols.decision, getDefaultGeometryPoints(FlowchartSymbols.decision, decisionPoint), '过程', options);
3228
+ const decisionElement = createGeometryElement(FlowchartSymbols.decision, getDefaultGeometryPoints(FlowchartSymbols.decision, decisionPoint), '判断', options);
2639
3229
  const processPoint2 = [decisionPoint[0] + decisionProperty.width / 2 + 75 + processProperty.width / 2, decisionPoint[1]];
2640
3230
  const processElement2 = createGeometryElement(FlowchartSymbols.process, getDefaultGeometryPoints(FlowchartSymbols.process, processPoint2), '过程', options);
2641
3231
  const endPoint = [decisionPoint[0], decisionPoint[1] + decisionProperty.height / 2 + 95 + terminalProperty.height / 2];
@@ -2714,10 +3304,7 @@ const getDefaultGeometryProperty = (pointer) => {
2714
3304
  return getDefaultFlowchartProperty(pointer);
2715
3305
  }
2716
3306
  else {
2717
- if (pointer === BasicShapes.cloud) {
2718
- return DefaultCloudShapeProperty;
2719
- }
2720
- return DefaultBasicShapeProperty;
3307
+ return getDefaultBasicShapeProperty(pointer);
2721
3308
  }
2722
3309
  };
2723
3310
  const getDefaultTextPoints = (board, centerPoint, fontSize) => {
@@ -2747,6 +3334,10 @@ const createDefaultGeometry = (board, points, shape) => {
2747
3334
  ...memorizedLatest.geometryProperties
2748
3335
  }, { ...memorizedLatest.textProperties, textHeight });
2749
3336
  };
3337
+ const editText = (element) => {
3338
+ const textManage = getFirstTextManage(element);
3339
+ textManage.edit();
3340
+ };
2750
3341
 
2751
3342
  const getStrokeWidthByElement = (element) => {
2752
3343
  if (PlaitDrawElement.isText(element)) {
@@ -3135,7 +3726,9 @@ const insertGeometry = (board, points, shape) => {
3135
3726
  return newElement;
3136
3727
  };
3137
3728
  const insertGeometryByVector = (board, point, shape, vector) => {
3138
- const shapeProperty = DefaultFlowchartPropertyMap[shape] || DefaultBasicShapeProperty;
3729
+ const shapeProperty = DefaultFlowchartPropertyMap[shape] ||
3730
+ DefaultBasicShapePropertyMap[shape] ||
3731
+ DefaultBasicShapeProperty;
3139
3732
  const direction = getDirectionByVector(vector);
3140
3733
  if (direction) {
3141
3734
  let offset = 0;
@@ -3274,6 +3867,7 @@ const DrawTransforms = {
3274
3867
  };
3275
3868
 
3276
3869
  class LineAutoCompleteGenerator extends Generator {
3870
+ static { this.key = 'line-auto-complete-generator'; }
3277
3871
  constructor(board) {
3278
3872
  super(board);
3279
3873
  this.board = board;
@@ -3315,14 +3909,13 @@ class LineAutoCompleteGenerator extends Generator {
3315
3909
  }
3316
3910
 
3317
3911
  class GeometryComponent extends CommonPluginElement {
3912
+ constructor() {
3913
+ super(...arguments);
3914
+ this.destroy$ = new Subject();
3915
+ }
3318
3916
  get textManage() {
3319
3917
  return this.getTextManages()[0];
3320
3918
  }
3321
- constructor(cdr) {
3322
- super(cdr);
3323
- this.cdr = cdr;
3324
- this.destroy$ = new Subject();
3325
- }
3326
3919
  initializeGenerator() {
3327
3920
  this.activeGenerator = new ActiveGenerator(this.board, {
3328
3921
  getStrokeWidth: () => {
@@ -3347,16 +3940,13 @@ class GeometryComponent extends CommonPluginElement {
3347
3940
  return RectangleClient.getRectangleByPoints(element.points);
3348
3941
  },
3349
3942
  hasResizeHandle: () => {
3350
- const selectedElements = getSelectedElements(this.board);
3351
- if (PlaitBoard.hasBeenTextEditing(this.board) && PlaitDrawElement.isText(this.element)) {
3352
- return false;
3353
- }
3354
- return selectedElements.length === 1 && !isSelectionMoving(this.board);
3943
+ return canResize(this.board, this.element);
3355
3944
  }
3356
3945
  });
3357
3946
  this.lineAutoCompleteGenerator = new LineAutoCompleteGenerator(this.board);
3358
3947
  this.shapeGenerator = new GeometryShapeGenerator(this.board);
3359
3948
  this.initializeTextManage();
3949
+ this.getRef().addGenerator(LineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
3360
3950
  }
3361
3951
  ngOnInit() {
3362
3952
  super.ngOnInit();
@@ -3369,6 +3959,7 @@ class GeometryComponent extends CommonPluginElement {
3369
3959
  this.drawText();
3370
3960
  }
3371
3961
  onContextChanged(value, previous) {
3962
+ this.initializeWeakMap();
3372
3963
  const isChangeTheme = this.board.operations.find(op => op.type === 'set_theme');
3373
3964
  if (value.element !== previous.element || isChangeTheme) {
3374
3965
  this.shapeGenerator.processDrawing(this.element, this.getElementG());
@@ -3389,10 +3980,6 @@ class GeometryComponent extends CommonPluginElement {
3389
3980
  }
3390
3981
  }
3391
3982
  }
3392
- editText() {
3393
- this.textManage.edit();
3394
- this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), { selected: this.selected });
3395
- }
3396
3983
  drawText() {
3397
3984
  this.textManage.draw(this.element.text);
3398
3985
  this.getElementG().append(this.textManage.g);
@@ -3440,13 +4027,13 @@ class GeometryComponent extends CommonPluginElement {
3440
4027
  }
3441
4028
  ngOnDestroy() {
3442
4029
  super.ngOnDestroy();
3443
- this.textManage.destroy();
3444
4030
  this.destroy$.next();
3445
4031
  this.destroy$.complete();
3446
4032
  this.activeGenerator.destroy();
3447
4033
  this.lineAutoCompleteGenerator.destroy();
4034
+ this.destroyTextManages();
3448
4035
  }
3449
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: GeometryComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
4036
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: GeometryComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
3450
4037
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: GeometryComponent, isStandalone: true, selector: "plait-draw-geometry", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3451
4038
  }
3452
4039
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: GeometryComponent, decorators: [{
@@ -3457,7 +4044,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
3457
4044
  changeDetection: ChangeDetectionStrategy.OnPush,
3458
4045
  standalone: true
3459
4046
  }]
3460
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
4047
+ }] });
3461
4048
 
3462
4049
  class LineActiveGenerator extends Generator {
3463
4050
  constructor() {
@@ -3491,19 +4078,21 @@ class LineActiveGenerator extends Generator {
3491
4078
  activeG.appendChild(updateHandle);
3492
4079
  });
3493
4080
  const middlePoints = getMiddlePoints(this.board, element);
3494
- for (let i = 0; i < middlePoints.length; i++) {
3495
- const point = middlePoints[i];
3496
- if (element.shape === LineShape.elbow && elbowNextRenderPoints.length) {
3497
- const handleIndex = getHitPointIndex(middlePoints, point);
3498
- const isUpdateHandleIndex = isUpdatedHandleIndex(this.board, element, [...points], elbowNextRenderPoints, handleIndex);
3499
- if (isUpdateHandleIndex) {
3500
- const updateHandle = drawPrimaryHandle(this.board, point);
3501
- activeG.appendChild(updateHandle);
3502
- continue;
4081
+ if (!PlaitBoard.hasBeenTextEditing(this.board)) {
4082
+ for (let i = 0; i < middlePoints.length; i++) {
4083
+ const point = middlePoints[i];
4084
+ if (element.shape === LineShape.elbow && elbowNextRenderPoints.length) {
4085
+ const handleIndex = getHitPointIndex(middlePoints, point);
4086
+ const isUpdateHandleIndex = isUpdatedHandleIndex(this.board, element, [...points], elbowNextRenderPoints, handleIndex);
4087
+ if (isUpdateHandleIndex) {
4088
+ const updateHandle = drawPrimaryHandle(this.board, point);
4089
+ activeG.appendChild(updateHandle);
4090
+ continue;
4091
+ }
3503
4092
  }
4093
+ const circle = drawFillPrimaryHandle(this.board, point);
4094
+ activeG.appendChild(circle);
3504
4095
  }
3505
- const circle = drawFillPrimaryHandle(this.board, point);
3506
- activeG.appendChild(circle);
3507
4096
  }
3508
4097
  }
3509
4098
  else {
@@ -3533,9 +4122,8 @@ class LineActiveGenerator extends Generator {
3533
4122
  const debugKey$2 = 'debug:plait:line-turning';
3534
4123
  const debugGenerator$2 = createDebugGenerator(debugKey$2);
3535
4124
  class LineComponent extends CommonPluginElement {
3536
- constructor(cdr) {
3537
- super(cdr);
3538
- this.cdr = cdr;
4125
+ constructor() {
4126
+ super(...arguments);
3539
4127
  this.destroy$ = new Subject();
3540
4128
  this.boundedElements = {};
3541
4129
  }
@@ -3574,6 +4162,7 @@ class LineComponent extends CommonPluginElement {
3574
4162
  return boundedElements;
3575
4163
  }
3576
4164
  onContextChanged(value, previous) {
4165
+ this.initializeWeakMap();
3577
4166
  const boundedElements = this.getBoundedElements();
3578
4167
  const isBoundedElementsChanged = boundedElements.source !== this.boundedElements.source || boundedElements.target !== this.boundedElements.target;
3579
4168
  this.boundedElements = boundedElements;
@@ -3678,7 +4267,7 @@ class LineComponent extends CommonPluginElement {
3678
4267
  this.destroy$.complete();
3679
4268
  this.destroyTextManages();
3680
4269
  }
3681
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: LineComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
4270
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: LineComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
3682
4271
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: LineComponent, isStandalone: true, selector: "plait-draw-line", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3683
4272
  }
3684
4273
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: LineComponent, decorators: [{
@@ -3689,7 +4278,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
3689
4278
  changeDetection: ChangeDetectionStrategy.OnPush,
3690
4279
  standalone: true
3691
4280
  }]
3692
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
4281
+ }] });
3693
4282
 
3694
4283
  const withDrawHotkey = (board) => {
3695
4284
  const { keyDown, dblClick } = board;
@@ -3704,7 +4293,7 @@ const withDrawHotkey = (board) => {
3704
4293
  isSingleSelection &&
3705
4294
  PlaitDrawElement.isGeometry(targetElement)) {
3706
4295
  event.preventDefault();
3707
- PlaitElement.getComponent(targetElement).editText();
4296
+ editText(targetElement);
3708
4297
  return;
3709
4298
  }
3710
4299
  keyDown(event);
@@ -3715,8 +4304,7 @@ const withDrawHotkey = (board) => {
3715
4304
  const point = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
3716
4305
  const hitElement = getHitElementByPoint(board, point);
3717
4306
  if (hitElement && PlaitDrawElement.isGeometry(hitElement)) {
3718
- const component = PlaitElement.getComponent(hitElement);
3719
- component.editText();
4307
+ editText(hitElement);
3720
4308
  }
3721
4309
  }
3722
4310
  dblClick(event);
@@ -4150,8 +4738,20 @@ function drawIsometricSnapLines(board, activePoints, snapRectangles, resizeSnapO
4150
4738
  return drawSolidLines(board, isometricLines);
4151
4739
  }
4152
4740
 
4741
+ const isGeometryDndMode = (board) => {
4742
+ const geometryPointers = getGeometryPointers();
4743
+ const isGeometryPointer = PlaitBoard.isInPointer(board, geometryPointers);
4744
+ const dndMode = isGeometryPointer && isDndMode(board);
4745
+ return dndMode;
4746
+ };
4747
+ const isGeometryDrawingMode = (board) => {
4748
+ const geometryPointers = getGeometryPointers();
4749
+ const isGeometryPointer = PlaitBoard.isInPointer(board, geometryPointers);
4750
+ const drawingMode = isGeometryPointer && isDrawingMode(board);
4751
+ return drawingMode;
4752
+ };
4153
4753
  const withGeometryCreateByDrag = (board) => {
4154
- const { pointerMove, globalPointerUp } = board;
4754
+ const { pointerMove, globalPointerUp, pointerUp } = board;
4155
4755
  let geometryShapeG = null;
4156
4756
  let temporaryElement = null;
4157
4757
  let fakeCreateTextRef = null;
@@ -4202,11 +4802,14 @@ const withGeometryCreateByDrag = (board) => {
4202
4802
  }
4203
4803
  pointerMove(event);
4204
4804
  };
4805
+ board.pointerUp = (event) => {
4806
+ if (isGeometryDndMode(board) && temporaryElement) {
4807
+ return;
4808
+ }
4809
+ pointerUp(event);
4810
+ };
4205
4811
  board.globalPointerUp = (event) => {
4206
- const geometryPointers = getGeometryPointers();
4207
- const isGeometryPointer = PlaitBoard.isInPointer(board, geometryPointers);
4208
- const dragMode = isGeometryPointer && isDndMode(board);
4209
- if (dragMode && temporaryElement) {
4812
+ if (isGeometryDndMode(board) && temporaryElement) {
4210
4813
  insertElement(board, temporaryElement);
4211
4814
  fakeCreateTextRef?.textManage.destroy();
4212
4815
  fakeCreateTextRef?.g.remove();
@@ -4235,9 +4838,7 @@ const withGeometryCreateByDrawing = (board) => {
4235
4838
  keyUp(event);
4236
4839
  };
4237
4840
  board.pointerDown = (event) => {
4238
- const geometryPointers = getGeometryPointers();
4239
- const isGeometryPointer = PlaitBoard.isInPointer(board, geometryPointers);
4240
- if (!PlaitBoard.isReadonly(board) && isGeometryPointer && isDrawingMode(board)) {
4841
+ if (!PlaitBoard.isReadonly(board) && isGeometryDrawingMode(board)) {
4241
4842
  const point = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
4242
4843
  start = point;
4243
4844
  const pointer = PlaitBoard.getPointer(board);
@@ -4260,7 +4861,7 @@ const withGeometryCreateByDrawing = (board) => {
4260
4861
  const movingPoint = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
4261
4862
  const pointer = PlaitBoard.getPointer(board);
4262
4863
  snapG?.remove();
4263
- if (start && pointer !== BasicShapes.text) {
4864
+ if (start && isGeometryDrawingMode(board)) {
4264
4865
  let points = normalizeShapePoints([start, movingPoint], isShift);
4265
4866
  const activeRectangle = RectangleClient.getRectangleByPoints(points);
4266
4867
  const [x, y] = getUnitVectorByPointAndPoint(start, movingPoint);
@@ -4282,27 +4883,27 @@ const withGeometryCreateByDrawing = (board) => {
4282
4883
  pointerMove(event);
4283
4884
  };
4284
4885
  board.pointerUp = (event) => {
4285
- const isDrawMode = !!start;
4286
- if (isDrawMode) {
4886
+ if (isGeometryDrawingMode(board) && start) {
4287
4887
  const targetPoint = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
4288
4888
  const { width, height } = RectangleClient.getRectangleByPoints([start, targetPoint]);
4289
- if (Math.hypot(width, height) === 0) {
4889
+ if (Math.hypot(width, height) < 8) {
4290
4890
  const pointer = PlaitBoard.getPointer(board);
4291
4891
  if (pointer !== BasicShapes.text) {
4292
4892
  const points = getDefaultGeometryPoints(pointer, targetPoint);
4293
4893
  temporaryElement = createDefaultGeometry(board, points, pointer);
4294
4894
  }
4295
4895
  }
4896
+ if (temporaryElement) {
4897
+ insertElement(board, temporaryElement);
4898
+ }
4899
+ snapG?.remove();
4900
+ geometryShapeG?.remove();
4901
+ geometryShapeG = null;
4902
+ start = null;
4903
+ temporaryElement = null;
4904
+ preventTouchMove(board, event, false);
4905
+ return;
4296
4906
  }
4297
- if (temporaryElement) {
4298
- insertElement(board, temporaryElement);
4299
- }
4300
- snapG?.remove();
4301
- geometryShapeG?.remove();
4302
- geometryShapeG = null;
4303
- start = null;
4304
- temporaryElement = null;
4305
- preventTouchMove(board, event, false);
4306
4907
  pointerUp(event);
4307
4908
  };
4308
4909
  return board;
@@ -4389,11 +4990,11 @@ const withDrawFragment = (baseBoard) => {
4389
4990
  }
4390
4991
  return getDeletedFragment(data);
4391
4992
  };
4392
- board.buildFragment = (clipboardContext, rectangle, type) => {
4393
- const targetDrawElements = getSelectedDrawElements(board);
4993
+ board.buildFragment = (clipboardContext, rectangle, operationType, originData) => {
4994
+ const targetDrawElements = getSelectedDrawElements(board, originData);
4394
4995
  let boundLineElements = [];
4395
4996
  if (targetDrawElements.length) {
4396
- if (type === 'cut') {
4997
+ if (operationType === WritableClipboardOperationType.cut) {
4397
4998
  const geometryElements = targetDrawElements.filter(value => PlaitDrawElement.isGeometry(value));
4398
4999
  const lineElements = targetDrawElements.filter(value => PlaitDrawElement.isLine(value));
4399
5000
  boundLineElements = getBoundedLineElements(board, geometryElements).filter(line => !lineElements.includes(line));
@@ -4412,9 +5013,9 @@ const withDrawFragment = (baseBoard) => {
4412
5013
  });
4413
5014
  }
4414
5015
  }
4415
- return buildFragment(clipboardContext, rectangle, type);
5016
+ return buildFragment(clipboardContext, rectangle, operationType, originData);
4416
5017
  };
4417
- board.insertFragment = (clipboardData, targetPoint) => {
5018
+ board.insertFragment = (clipboardData, targetPoint, operationType) => {
4418
5019
  const selectedElements = getSelectedElements(board);
4419
5020
  if (clipboardData?.files?.length) {
4420
5021
  const acceptImageArray = acceptImageTypes.map(type => 'image/' + type);
@@ -4444,7 +5045,7 @@ const withDrawFragment = (baseBoard) => {
4444
5045
  }
4445
5046
  }
4446
5047
  }
4447
- insertFragment(clipboardData, targetPoint);
5048
+ insertFragment(clipboardData, targetPoint, operationType);
4448
5049
  };
4449
5050
  return board;
4450
5051
  };
@@ -4514,8 +5115,7 @@ const withGeometryResize = (board) => {
4514
5115
  return null;
4515
5116
  }
4516
5117
  const target = selectedElements[0];
4517
- const targetComponent = PlaitElement.getComponent(selectedElements[0]);
4518
- if (targetComponent.activeGenerator.hasResizeHandle) {
5118
+ if (canResize(board, target)) {
4519
5119
  const rectangle = board.getRectangle(target);
4520
5120
  const handleRef = getHitRectangleResizeHandleRef(board, rectangle, point, target.angle);
4521
5121
  if (handleRef) {
@@ -4766,6 +5366,7 @@ const withLineText = (board) => {
4766
5366
  const hitTarget = getHitElementByPoint(board, clickPoint, (element) => {
4767
5367
  return PlaitDrawElement.isLine(element);
4768
5368
  });
5369
+ const hitTargetPath = hitTarget && PlaitBoard.findPath(board, hitTarget);
4769
5370
  if (hitTarget) {
4770
5371
  const points = getLinePoints(board, hitTarget);
4771
5372
  const point = getNearestPointBetweenPointAndSegments(clickPoint, points);
@@ -4785,8 +5386,11 @@ const withLineText = (board) => {
4785
5386
  });
4786
5387
  DrawTransforms.setLineTexts(board, hitTarget, texts);
4787
5388
  setTimeout(() => {
4788
- const hitComponent = PlaitElement.getComponent(hitTarget);
4789
- editHandle(board, hitTarget, hitComponent.getTextManages().length - 1, true);
5389
+ if (hitTargetPath) {
5390
+ const newHitTarget = PlaitNode.get(board, hitTargetPath);
5391
+ const textManages = getTextManages(newHitTarget);
5392
+ editHandle(board, newHitTarget, textManages.length - 1, true);
5393
+ }
4790
5394
  });
4791
5395
  }
4792
5396
  }
@@ -4796,8 +5400,8 @@ const withLineText = (board) => {
4796
5400
  return board;
4797
5401
  };
4798
5402
  function editHandle(board, element, manageIndex, isFirstEdit = false) {
4799
- const hitComponent = PlaitElement.getComponent(element);
4800
- const textManage = hitComponent.getTextManages()[manageIndex];
5403
+ const textManages = getTextManages(element);
5404
+ const textManage = textManages[manageIndex];
4801
5405
  const originText = textManage.componentRef.instance.children;
4802
5406
  textManage.edit((origin, descendant) => {
4803
5407
  const text = Node.string(descendant[0]);
@@ -4809,14 +5413,13 @@ function editHandle(board, element, manageIndex, isFirstEdit = false) {
4809
5413
  }
4810
5414
 
4811
5415
  class ImageComponent extends CommonPluginElement {
5416
+ constructor() {
5417
+ super(...arguments);
5418
+ this.destroy$ = new Subject();
5419
+ }
4812
5420
  get activeGenerator() {
4813
5421
  return this.imageGenerator.componentRef.instance.activeGenerator;
4814
5422
  }
4815
- constructor(cdr) {
4816
- super(cdr);
4817
- this.cdr = cdr;
4818
- this.destroy$ = new Subject();
4819
- }
4820
5423
  initializeGenerator() {
4821
5424
  this.imageGenerator = new ImageGenerator(this.board, {
4822
5425
  getRectangle: (element) => {
@@ -4836,6 +5439,7 @@ class ImageComponent extends CommonPluginElement {
4836
5439
  }
4837
5440
  });
4838
5441
  this.lineAutoCompleteGenerator = new LineAutoCompleteGenerator(this.board);
5442
+ this.getRef().addGenerator(LineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
4839
5443
  }
4840
5444
  ngOnInit() {
4841
5445
  super.ngOnInit();
@@ -4871,7 +5475,7 @@ class ImageComponent extends CommonPluginElement {
4871
5475
  this.imageGenerator.destroy();
4872
5476
  this.lineAutoCompleteGenerator.destroy();
4873
5477
  }
4874
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ImageComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
5478
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ImageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
4875
5479
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: ImageComponent, isStandalone: true, selector: "plait-draw-geometry", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4876
5480
  }
4877
5481
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ImageComponent, decorators: [{
@@ -4882,7 +5486,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
4882
5486
  changeDetection: ChangeDetectionStrategy.OnPush,
4883
5487
  standalone: true
4884
5488
  }]
4885
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
5489
+ }] });
4886
5490
 
4887
5491
  const withLineAutoCompleteReaction = (board) => {
4888
5492
  const { pointerMove } = board;
@@ -4897,10 +5501,11 @@ const withLineAutoCompleteReaction = (board) => {
4897
5501
  const points = getAutoCompletePoints(targetElement);
4898
5502
  const hitIndex = getHitIndexOfAutoCompletePoint(rotateAntiPointsByElement(movingPoint, targetElement) || movingPoint, points);
4899
5503
  const hitPoint = points[hitIndex];
4900
- const component = PlaitElement.getComponent(targetElement);
4901
- component.lineAutoCompleteGenerator.recoverAutoCompleteG();
5504
+ const ref = PlaitElement.getElementRef(targetElement);
5505
+ const lineAutoCompleteGenerator = ref.getGenerator(LineAutoCompleteGenerator.key);
5506
+ lineAutoCompleteGenerator.recoverAutoCompleteG();
4902
5507
  if (hitPoint) {
4903
- component.lineAutoCompleteGenerator.removeAutoCompleteG(hitIndex);
5508
+ lineAutoCompleteGenerator.removeAutoCompleteG(hitIndex);
4904
5509
  reactionG = drawCircle(PlaitBoard.getRoughSVG(board), hitPoint, LINE_AUTO_COMPLETE_HOVERED_DIAMETER, {
4905
5510
  stroke: 'none',
4906
5511
  fill: RgbaToHEX(PRIMARY_COLOR, LINE_AUTO_COMPLETE_HOVERED_OPACITY),
@@ -5001,8 +5606,8 @@ const withLineTextMove = (board) => {
5001
5606
  });
5002
5607
  if (line) {
5003
5608
  const index = getHitLineTextIndex(board, line, point);
5004
- const hitComponent = PlaitElement.getComponent(line);
5005
- const textManage = hitComponent.getTextManages()[index];
5609
+ const textManages = getTextManages(line);
5610
+ const textManage = textManages[index];
5006
5611
  if (index !== -1 && !textManage.isEditing) {
5007
5612
  textIndex = index;
5008
5613
  return { element: line, handle: ResizeHandle.e };
@@ -5075,12 +5680,13 @@ const withDrawRotate = (board) => {
5075
5680
  throttleRAF(board, 'with-common-rotate', () => {
5076
5681
  if (rotateRef && rotateRef.startPoint) {
5077
5682
  let angle = getAngleBetweenPoints(rotateRef.startPoint, endPoint, selectionCenterPoint);
5683
+ const selectionAngle = getSelectionAngle(rotateRef.elements);
5684
+ angle = normalizeAngle(selectionAngle + angle);
5078
5685
  if (isShift) {
5079
5686
  angle += Math.PI / 12 / 2;
5080
5687
  angle -= angle % (Math.PI / 12);
5081
5688
  }
5082
- const selectionAngle = getSelectionAngle(rotateRef.elements);
5083
- let remainder = (selectionAngle + angle) % (Math.PI / 2);
5689
+ let remainder = angle % (Math.PI / 2);
5084
5690
  if (Math.PI / 2 - remainder <= degreesToRadians(5)) {
5085
5691
  const snapAngle = Math.PI / 2 - remainder;
5086
5692
  angle += snapAngle;
@@ -5089,10 +5695,8 @@ const withDrawRotate = (board) => {
5089
5695
  const snapAngle = -remainder;
5090
5696
  angle += snapAngle;
5091
5697
  }
5092
- rotateRef.angle = normalizeAngle(angle);
5093
- if (rotateRef.angle) {
5094
- rotateElements(board, rotateRef.elements, rotateRef.angle);
5095
- }
5698
+ rotateRef.angle = normalizeAngle(angle - selectionAngle) || 0;
5699
+ rotateElements(board, rotateRef.elements, rotateRef.angle);
5096
5700
  PlaitBoard.getBoardContainer(board).classList.add('element-rotating');
5097
5701
  }
5098
5702
  });
@@ -5241,7 +5845,7 @@ const withDraw = (board) => {
5241
5845
  return isAlign(element);
5242
5846
  };
5243
5847
  board.getRelatedFragment = (elements, originData) => {
5244
- const selectedElements = originData || getSelectedElements(board);
5848
+ const selectedElements = originData?.length ? originData : getSelectedElements(board);
5245
5849
  const lineElements = board.children.filter(element => PlaitDrawElement.isLine(element));
5246
5850
  const activeLines = lineElements.filter(line => {
5247
5851
  const source = selectedElements.find(element => element.id === line.source.boundId);
@@ -5251,12 +5855,12 @@ const withDraw = (board) => {
5251
5855
  });
5252
5856
  return getRelatedFragment([...elements, ...activeLines], originData);
5253
5857
  };
5254
- return withDrawResize(withLineTextMove(withLineAutoCompleteReaction(withLineText(withLineBoundReaction(withLineResize(withGeometryResize(withDrawRotate(withLineCreateByDraw(withLineAutoComplete(withGeometryCreateByDrag(withGeometryCreateByDrawing(withDrawFragment(withDrawHotkey(board))))))))))))));
5858
+ return withDrawResize(withLineResize(withLineTextMove(withLineAutoCompleteReaction(withLineText(withLineBoundReaction(withGeometryResize(withDrawRotate(withLineCreateByDraw(withLineAutoComplete(withGeometryCreateByDrag(withGeometryCreateByDrawing(withDrawFragment(withDrawHotkey(board))))))))))))));
5255
5859
  };
5256
5860
 
5257
5861
  /**
5258
5862
  * Generated bundle index. Do not edit.
5259
5863
  */
5260
5864
 
5261
- export { BasicShapes, DEFAULT_IMAGE_WIDTH, DefaultBasicShapeProperty, DefaultCloudShapeProperty, DefaultConnectorProperty, DefaultDataProperty, DefaultDecisionProperty, DefaultFlowchartProperty, DefaultFlowchartPropertyMap, DefaultGeometryActiveStyle, DefaultGeometryStyle, DefaultManualInputProperty, DefaultMergeProperty, DefaultTextProperty, DrawThemeColors, DrawTransforms, FlowchartSymbols, GeometryComponent, GeometryThreshold, LINE_HIT_GEOMETRY_BUFFER, LINE_SNAPPING_BUFFER, LINE_SNAPPING_CONNECTOR_BUFFER, LineComponent, LineHandleKey, LineMarkerType, LineShape, MemorizeKey, PlaitDrawElement, PlaitGeometry, PlaitLine, Q2C, ShapeDefaultSpace, StrokeStyle, WithLineAutoCompletePluginKey, alignElbowSegment, alignPoints, createDefaultFlowchart, createDefaultGeometry, createGeometryElement, createLineElement, createTextElement, drawBoundReaction, drawGeometry, drawLine, drawLineArrow, getAutoCompletePoints, getBasicPointers, getCenterPointsOnPolygon, getConnectionPoint, getCurvePoints, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultTextPoints, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryPointers, getHitConnection, getHitConnectorPoint, getHitIndexOfAutoCompletePoint, getIndexAndDeleteCountByKeyPoint, getLineDashByElement, getLineHandleRefPair, getLineMemorizedLatest, getLinePointers, getLinePoints, getLineTextRectangle, getLines, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedLineElements, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getTextRectangle, getTextShapeProperty, getVectorByConnection, handleLineCreating, hasIllegalElbowPoint, insertElement, isHitDrawElement, isHitEdgeOfShape, isHitElementInside, isHitLine, isHitLineText, isHitPolyLine, isInsideOfShape, isRectangleHitDrawElement, isSelfLoop, isTextExceedingBounds, isUpdatedHandleIndex, isUseDefaultOrthogonalRoute, memorizeLatestShape, memorizeLatestText, withDraw, withLineAutoComplete };
5865
+ export { BasicShapes, DEFAULT_IMAGE_WIDTH, DefaultArrowProperty, DefaultBasicShapeProperty, DefaultBasicShapePropertyMap, DefaultCloudProperty, DefaultConnectorProperty, DefaultDataBaseProperty, DefaultDataProperty, DefaultDecisionProperty, DefaultDocumentProperty, DefaultFlowchartProperty, DefaultFlowchartPropertyMap, DefaultGeometryActiveStyle, DefaultGeometryStyle, DefaultInternalStorageProperty, DefaultManualInputProperty, DefaultMergeProperty, DefaultMultiDocumentProperty, DefaultNoteProperty, DefaultPentagonArrowProperty, DefaultTextProperty, DefaultTwoWayArrowProperty, DrawThemeColors, DrawTransforms, FlowchartSymbols, GeometryComponent, GeometryThreshold, LINE_HIT_GEOMETRY_BUFFER, LINE_SNAPPING_BUFFER, LINE_SNAPPING_CONNECTOR_BUFFER, LineComponent, LineHandleKey, LineMarkerType, LineShape, MemorizeKey, PlaitDrawElement, PlaitGeometry, PlaitLine, Q2C, ShapeDefaultSpace, StrokeStyle, WithLineAutoCompletePluginKey, alignElbowSegment, alignPoints, createDefaultFlowchart, createDefaultGeometry, createGeometryElement, createLineElement, createTextElement, drawBoundReaction, drawGeometry, drawLine, drawLineArrow, editText, getAutoCompletePoints, getBasicPointers, getCenterPointsOnPolygon, getConnectionPoint, getCurvePoints, getDefaultBasicShapeProperty, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultTextPoints, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryPointers, getHitConnection, getHitConnectorPoint, getHitIndexOfAutoCompletePoint, getIndexAndDeleteCountByKeyPoint, getLineDashByElement, getLineHandleRefPair, getLineMemorizedLatest, getLinePointers, getLinePoints, getLineTextRectangle, getLines, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedLineElements, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getTextRectangle, getTextShapeProperty, getVectorByConnection, handleLineCreating, hasIllegalElbowPoint, insertElement, isHitDrawElement, isHitEdgeOfShape, isHitElementInside, isHitLine, isHitLineText, isHitPolyLine, isInsideOfShape, isRectangleHitDrawElement, isSelfLoop, isTextExceedingBounds, isUpdatedHandleIndex, isUseDefaultOrthogonalRoute, memorizeLatestShape, memorizeLatestText, withDraw, withLineAutoComplete };
5262
5866
  //# sourceMappingURL=plait-draw.mjs.map