@plait/draw 0.62.0-next.5 → 0.62.0-next.7

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 (137) hide show
  1. package/arrow-line.component.d.ts +26 -0
  2. package/constants/pointer.d.ts +3 -3
  3. package/esm2022/arrow-line.component.mjs +157 -0
  4. package/esm2022/constants/geometry.mjs +3 -3
  5. package/esm2022/constants/pointer.mjs +4 -4
  6. package/esm2022/engines/flowchart/note-curly-left.mjs +2 -2
  7. package/esm2022/engines/flowchart/note-curly-right.mjs +7 -7
  8. package/esm2022/engines/flowchart/note-square.mjs +2 -2
  9. package/esm2022/engines/uml/required-interface.mjs +3 -2
  10. package/esm2022/generators/arrow-line-active.generator.mjs +81 -0
  11. package/esm2022/generators/arrow-line-auto-complete.generator.mjs +46 -0
  12. package/esm2022/generators/arrow-line.generator.mjs +13 -0
  13. package/esm2022/generators/index.mjs +3 -3
  14. package/esm2022/geometry.component.mjs +4 -4
  15. package/esm2022/image.component.mjs +4 -4
  16. package/esm2022/interfaces/arrow-line.mjs +70 -0
  17. package/esm2022/interfaces/element.mjs +2 -2
  18. package/esm2022/interfaces/index.mjs +14 -7
  19. package/esm2022/interfaces/vector-line.mjs +6 -0
  20. package/esm2022/plugins/with-arrow-line-auto-complete-reaction.mjs +41 -0
  21. package/esm2022/plugins/with-arrow-line-auto-complete.mjs +74 -0
  22. package/esm2022/plugins/with-arrow-line-bound-reaction.mjs +53 -0
  23. package/esm2022/plugins/with-arrow-line-create.mjs +53 -0
  24. package/esm2022/plugins/with-arrow-line-resize.mjs +158 -0
  25. package/esm2022/plugins/with-arrow-line-text-move.mjs +53 -0
  26. package/esm2022/plugins/with-arrow-line-text.mjs +63 -0
  27. package/esm2022/plugins/with-draw-fragment.mjs +13 -13
  28. package/esm2022/plugins/with-draw-resize.mjs +12 -5
  29. package/esm2022/plugins/with-draw.mjs +27 -20
  30. package/esm2022/plugins/with-geometry-resize.mjs +1 -1
  31. package/esm2022/plugins/with-swimlane.mjs +1 -20
  32. package/esm2022/plugins/with-table.mjs +21 -3
  33. package/esm2022/public-api.mjs +3 -3
  34. package/esm2022/table.component.mjs +6 -6
  35. package/esm2022/transforms/arrow-line.mjs +100 -0
  36. package/esm2022/transforms/geometry.mjs +4 -4
  37. package/esm2022/transforms/index.mjs +12 -11
  38. package/esm2022/transforms/swimlane.mjs +1 -29
  39. package/esm2022/transforms/table-text.mjs +5 -5
  40. package/esm2022/transforms/table.mjs +30 -0
  41. package/esm2022/utils/arrow-line/arrow-line-arrow.mjs +123 -0
  42. package/esm2022/utils/arrow-line/arrow-line-basic.mjs +257 -0
  43. package/esm2022/utils/arrow-line/arrow-line-common.mjs +127 -0
  44. package/esm2022/utils/arrow-line/arrow-line-resize.mjs +309 -0
  45. package/esm2022/utils/arrow-line/elbow.mjs +114 -0
  46. package/esm2022/utils/arrow-line/index.mjs +6 -0
  47. package/esm2022/utils/clipboard.mjs +10 -10
  48. package/esm2022/utils/common.mjs +3 -3
  49. package/esm2022/utils/geometry.mjs +13 -13
  50. package/esm2022/utils/hit.mjs +67 -44
  51. package/esm2022/utils/index.mjs +2 -2
  52. package/esm2022/utils/memorize.mjs +4 -5
  53. package/esm2022/utils/position/arrow-line.mjs +67 -0
  54. package/esm2022/utils/position/geometry.mjs +1 -1
  55. package/esm2022/utils/selected.mjs +3 -3
  56. package/esm2022/utils/swimlane.mjs +11 -5
  57. package/esm2022/utils/table-selected.mjs +3 -4
  58. package/esm2022/utils/table.mjs +16 -1
  59. package/fesm2022/plait-draw.mjs +448 -372
  60. package/fesm2022/plait-draw.mjs.map +1 -1
  61. package/generators/arrow-line-active.generator.d.ts +13 -0
  62. package/generators/{line-auto-complete.generator.d.ts → arrow-line-auto-complete.generator.d.ts} +1 -1
  63. package/generators/arrow-line.generator.d.ts +8 -0
  64. package/generators/index.d.ts +2 -2
  65. package/geometry.component.d.ts +2 -2
  66. package/image.component.d.ts +2 -2
  67. package/interfaces/arrow-line.d.ts +75 -0
  68. package/interfaces/element.d.ts +1 -1
  69. package/interfaces/index.d.ts +6 -4
  70. package/interfaces/vector-line.d.ts +16 -0
  71. package/package.json +1 -1
  72. package/plugins/with-arrow-line-auto-complete-reaction.d.ts +2 -0
  73. package/plugins/with-arrow-line-auto-complete.d.ts +7 -0
  74. package/plugins/with-arrow-line-bound-reaction.d.ts +2 -0
  75. package/plugins/with-arrow-line-create.d.ts +2 -0
  76. package/plugins/with-arrow-line-resize.d.ts +2 -0
  77. package/plugins/with-arrow-line-text-move.d.ts +2 -0
  78. package/plugins/with-arrow-line-text.d.ts +2 -0
  79. package/plugins/with-draw-fragment.d.ts +2 -2
  80. package/plugins/with-swimlane.d.ts +1 -2
  81. package/public-api.d.ts +2 -2
  82. package/table.component.d.ts +2 -2
  83. package/transforms/arrow-line.d.ts +12 -0
  84. package/transforms/index.d.ts +8 -8
  85. package/transforms/swimlane.d.ts +1 -3
  86. package/transforms/table-text.d.ts +2 -3
  87. package/transforms/table.d.ts +3 -0
  88. package/utils/arrow-line/arrow-line-arrow.d.ts +4 -0
  89. package/utils/arrow-line/arrow-line-basic.d.ts +13 -0
  90. package/utils/{line/line-common.d.ts → arrow-line/arrow-line-common.d.ts} +3 -3
  91. package/utils/{line/line-resize.d.ts → arrow-line/arrow-line-resize.d.ts} +3 -3
  92. package/utils/{line → arrow-line}/elbow.d.ts +7 -7
  93. package/utils/arrow-line/index.d.ts +5 -0
  94. package/utils/clipboard.d.ts +4 -4
  95. package/utils/geometry.d.ts +17 -17
  96. package/utils/hit.d.ts +7 -4
  97. package/utils/index.d.ts +1 -1
  98. package/utils/position/arrow-line.d.ts +16 -0
  99. package/utils/selected.d.ts +2 -2
  100. package/utils/swimlane.d.ts +1 -1
  101. package/utils/table.d.ts +2 -0
  102. package/esm2022/generators/line-active.generator.mjs +0 -81
  103. package/esm2022/generators/line-auto-complete.generator.mjs +0 -46
  104. package/esm2022/generators/line.generator.mjs +0 -13
  105. package/esm2022/interfaces/line.mjs +0 -70
  106. package/esm2022/line.component.mjs +0 -155
  107. package/esm2022/plugins/with-line-auto-complete-reaction.mjs +0 -41
  108. package/esm2022/plugins/with-line-auto-complete.mjs +0 -75
  109. package/esm2022/plugins/with-line-bound-reaction.mjs +0 -53
  110. package/esm2022/plugins/with-line-create.mjs +0 -53
  111. package/esm2022/plugins/with-line-resize.mjs +0 -158
  112. package/esm2022/plugins/with-line-text-move.mjs +0 -53
  113. package/esm2022/plugins/with-line-text.mjs +0 -62
  114. package/esm2022/transforms/line.mjs +0 -100
  115. package/esm2022/utils/line/elbow.mjs +0 -114
  116. package/esm2022/utils/line/index.mjs +0 -6
  117. package/esm2022/utils/line/line-arrow.mjs +0 -123
  118. package/esm2022/utils/line/line-basic.mjs +0 -257
  119. package/esm2022/utils/line/line-common.mjs +0 -123
  120. package/esm2022/utils/line/line-resize.mjs +0 -309
  121. package/esm2022/utils/position/line.mjs +0 -67
  122. package/generators/line-active.generator.d.ts +0 -13
  123. package/generators/line.generator.d.ts +0 -8
  124. package/interfaces/line.d.ts +0 -75
  125. package/line.component.d.ts +0 -26
  126. package/plugins/with-line-auto-complete-reaction.d.ts +0 -2
  127. package/plugins/with-line-auto-complete.d.ts +0 -7
  128. package/plugins/with-line-bound-reaction.d.ts +0 -2
  129. package/plugins/with-line-create.d.ts +0 -2
  130. package/plugins/with-line-resize.d.ts +0 -2
  131. package/plugins/with-line-text-move.d.ts +0 -2
  132. package/plugins/with-line-text.d.ts +0 -2
  133. package/transforms/line.d.ts +0 -12
  134. package/utils/line/index.d.ts +0 -5
  135. package/utils/line/line-arrow.d.ts +0 -4
  136. package/utils/line/line-basic.d.ts +0 -13
  137. package/utils/position/line.d.ts +0 -16
@@ -1,5 +1,5 @@
1
- import { ACTIVE_STROKE_WIDTH, ThemeColorMode, RectangleClient, idCreator, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, rotatePointsByElement, isPolylineHitRectangle, rotateAntiPointsByElement, distanceBetweenPointAndPoint, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, depthFirstRecursion, PlaitBoard, getIsRecursionFunc, createG, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, createDebugGenerator, Point, arrowPoints, createPath, drawLinearPath, rotate, catmullRomFitting, setStrokeLinecap, findElements, createMask, createRect, PlaitElement, getSelectedElements, getElementById, Path, Direction, PlaitNode, hasValidAngle, toViewBoxPoint, toHostPoint, rotatePoints, getRectangleByElements, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, isSelectionMoving, drawRectangle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, isPointInPolygon, getNearestPointBetweenPointAndSegments, isPointInEllipse, getNearestPointBetweenPointAndEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRoundRectangle, isPointInRoundRectangle, setPathStrokeLinecap, getCrossingPointsBetweenEllipseAndSegment, drawLine as drawLine$1, RgbaToHEX, getHitElementByPoint, preventTouchMove, WritableClipboardOperationType, createClipboardContext, WritableClipboardType, addClipboardContext, setAngleForG, CursorClass, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER, isMainPointer, throttleRAF, getAngleBetweenPoints, normalizeAngle, degreesToRadians, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, SELECTION_RECTANGLE_CLASS_NAME, isSelectedElement, isDragging } from '@plait/core';
2
- import { Alignment, WithTextPluginKey, ELEMENT_TO_TEXT_MANAGES, TextManage, getMemorizedLatest, memorizeLatest, RESIZE_HANDLE_DIAMETER, getPointOnPolyline, buildText, TRANSPARENT, getTextEditorsByElement, Generator, removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, getExtendPoint, getUnitVectorByPointAndPoint, getPointByVectorComponent, measureElement, DEFAULT_FONT_FAMILY, getFirstTextManage, ActiveGenerator, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, getDirectionByVector, normalizeShapePoints, getFirstTextEditor, resetPointsAfterResize, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, ROTATE_HANDLE_SIZE, isCornerHandle, getIndexByResizeHandle, withResize, drawHandle, getSymmetricHandleIndex, getResizeHandlePointByIndex, getDirectionFactorByDirectionComponent, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getDirectionByPointOfRectangle, getDirectionFactor, rotateVector, getOppositeDirection, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, PRIMARY_COLOR, CommonElementFlavour, canResize, drawPrimaryHandle, drawFillPrimaryHandle, isVirtualKey, isDelete, isSpaceHotkey, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, isResizingByCondition, getRatioByPoint, getTextManages, ImageGenerator, ResizeHandle, addRotating, removeRotating, drawRotateHandle } from '@plait/common';
1
+ import { ACTIVE_STROKE_WIDTH, ThemeColorMode, RectangleClient, getSelectedElements, idCreator, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, rotatePointsByElement, isPolylineHitRectangle, rotateAntiPointsByElement, distanceBetweenPointAndPoint, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, depthFirstRecursion, PlaitBoard, getIsRecursionFunc, createG, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, createDebugGenerator, Point, arrowPoints, createPath, drawLinearPath, rotate, catmullRomFitting, setStrokeLinecap, findElements, createMask, createRect, PlaitElement, getElementById, Path, Direction, PlaitNode, hasValidAngle, toViewBoxPoint, toHostPoint, rotatePoints, getRectangleByElements, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, isSelectionMoving, drawRectangle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, isPointInPolygon, getNearestPointBetweenPointAndSegments, isPointInEllipse, getNearestPointBetweenPointAndEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRoundRectangle, isPointInRoundRectangle, setPathStrokeLinecap, getCrossingPointsBetweenEllipseAndSegment, drawLine, RgbaToHEX, getHitElementByPoint, preventTouchMove, WritableClipboardOperationType, createClipboardContext, WritableClipboardType, addClipboardContext, setAngleForG, CursorClass, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER, isMainPointer, throttleRAF, getAngleBetweenPoints, normalizeAngle, degreesToRadians, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, SELECTION_RECTANGLE_CLASS_NAME, isSelectedElement, isDragging } from '@plait/core';
2
+ import { DEFAULT_FILL, Alignment, WithTextPluginKey, ELEMENT_TO_TEXT_MANAGES, TextManage, getMemorizedLatest, memorizeLatest, RESIZE_HANDLE_DIAMETER, getPointOnPolyline, buildText, sortElementsByArea, isFilled, getTextEditorsByElement, Generator, removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, getExtendPoint, getUnitVectorByPointAndPoint, getPointByVectorComponent, measureElement, DEFAULT_FONT_FAMILY, getFirstTextManage, ActiveGenerator, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, getDirectionByVector, normalizeShapePoints, getFirstTextEditor, resetPointsAfterResize, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, ROTATE_HANDLE_SIZE, isCornerHandle, getIndexByResizeHandle, withResize, drawHandle, getSymmetricHandleIndex, getResizeHandlePointByIndex, getDirectionFactorByDirectionComponent, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getDirectionByPointOfRectangle, getDirectionFactor, rotateVector, getOppositeDirection, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, PRIMARY_COLOR, CommonElementFlavour, canResize, drawPrimaryHandle, drawFillPrimaryHandle, isVirtualKey, isDelete, isSpaceHotkey, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, isResizingByCondition, getRatioByPoint, getTextManages, ImageGenerator, ResizeHandle, addRotating, removeRotating, drawRotateHandle } from '@plait/common';
3
3
  import { pointsOnBezierCurves } from 'points-on-curve';
4
4
  import { TEXT_DEFAULT_HEIGHT, DEFAULT_FONT_SIZE, AlignEditor } from '@plait/text-plugins';
5
5
  import { isKeyHotkey } from 'is-hotkey';
@@ -120,7 +120,7 @@ const DefaultDrawStyle = {
120
120
  strokeWidth: 2,
121
121
  defaultRadius: 4,
122
122
  strokeColor: '#000',
123
- fill: 'none'
123
+ fill: DEFAULT_FILL
124
124
  };
125
125
  const DefaultDrawActiveStyle = {
126
126
  strokeWidth: ACTIVE_STROKE_WIDTH,
@@ -390,8 +390,8 @@ const getFlowchartPointers = () => {
390
390
  const getUMLPointers = () => {
391
391
  return Object.keys(UMLSymbols);
392
392
  };
393
- const getLinePointers = () => {
394
- return Object.keys(LineShape);
393
+ const getArrowLinePointers = () => {
394
+ return Object.keys(ArrowLineShape);
395
395
  };
396
396
 
397
397
  const DEFAULT_IMAGE_WIDTH = 1000;
@@ -578,6 +578,29 @@ class TextGenerator {
578
578
  }
579
579
  }
580
580
 
581
+ const isSingleSelectTable = (board) => {
582
+ const selectedElements = getSelectedElements(board);
583
+ return selectedElements && selectedElements.length === 1 && PlaitDrawElement.isElementByTable(selectedElements[0]);
584
+ };
585
+ const isSingleSelectElementByTable = (board) => {
586
+ const selectedElements = getSelectedElements(board);
587
+ return selectedElements && selectedElements.length === 1 && PlaitDrawElement.isElementByTable(selectedElements[0]);
588
+ };
589
+ const getSelectedTableElements = (board, elements) => {
590
+ const selectedElements = elements?.length ? elements : getSelectedElements(board);
591
+ return selectedElements.filter(value => PlaitDrawElement.isElementByTable(value));
592
+ };
593
+ const SELECTED_CELLS = new WeakMap();
594
+ function getSelectedCells(element) {
595
+ return SELECTED_CELLS.get(element);
596
+ }
597
+ function setSelectedCells(element, cells) {
598
+ return SELECTED_CELLS.set(element, cells);
599
+ }
600
+ function clearSelectedCells(element) {
601
+ return SELECTED_CELLS.delete(element);
602
+ }
603
+
581
604
  function getCellsWithPoints(board, element) {
582
605
  const table = board.buildTable(element);
583
606
  const rectangle = RectangleClient.getRectangleByPoints(table.points);
@@ -722,6 +745,20 @@ const createCell = (rowId, columnId, text = null) => {
722
745
  }
723
746
  return cell;
724
747
  };
748
+ const getSelectedTableCellsEditor = (board) => {
749
+ if (isSingleSelectElementByTable(board)) {
750
+ const elements = getSelectedTableElements(board);
751
+ const selectedCells = getSelectedCells(elements[0]);
752
+ const selectedCellsEditor = selectedCells?.map(cell => {
753
+ const textManage = getTextManageByCell(cell);
754
+ return textManage?.editor;
755
+ });
756
+ if (selectedCellsEditor?.length) {
757
+ return selectedCellsEditor;
758
+ }
759
+ }
760
+ return undefined;
761
+ };
725
762
 
726
763
  const SHAPE_MAX_LENGTH = 6;
727
764
  const memorizedShape = new WeakMap();
@@ -740,8 +777,8 @@ const getMemorizeKey = (element) => {
740
777
  key = MemorizeKey.flowchart;
741
778
  break;
742
779
  }
743
- case PlaitDrawElement.isLine(element): {
744
- key = MemorizeKey.line;
780
+ case PlaitDrawElement.isArrowLine(element): {
781
+ key = MemorizeKey.arrowLine;
745
782
  break;
746
783
  }
747
784
  case PlaitDrawElement.isUML(element): {
@@ -751,8 +788,7 @@ const getMemorizeKey = (element) => {
751
788
  return key;
752
789
  };
753
790
  const getLineMemorizedLatest = () => {
754
- const properties = getMemorizedLatest(MemorizeKey.line);
755
- delete properties?.text;
791
+ const properties = getMemorizedLatest(MemorizeKey.arrowLine);
756
792
  return { ...properties } || {};
757
793
  };
758
794
  const getMemorizedLatestByPointer = (pointer) => {
@@ -815,25 +851,25 @@ const getMemorizedLatestShape = (board) => {
815
851
  return memorizedShape.get(board);
816
852
  };
817
853
 
818
- var LineResizeHandle;
819
- (function (LineResizeHandle) {
820
- LineResizeHandle["source"] = "source";
821
- LineResizeHandle["target"] = "target";
822
- LineResizeHandle["addHandle"] = "addHandle";
823
- })(LineResizeHandle || (LineResizeHandle = {}));
824
- const getHitLineResizeHandleRef = (board, element, point) => {
825
- let dataPoints = PlaitLine.getPoints(board, element);
854
+ var ArrowLineResizeHandle;
855
+ (function (ArrowLineResizeHandle) {
856
+ ArrowLineResizeHandle["source"] = "source";
857
+ ArrowLineResizeHandle["target"] = "target";
858
+ ArrowLineResizeHandle["addHandle"] = "addHandle";
859
+ })(ArrowLineResizeHandle || (ArrowLineResizeHandle = {}));
860
+ const getHitArrowLineResizeHandleRef = (board, element, point) => {
861
+ let dataPoints = PlaitArrowLine.getPoints(board, element);
826
862
  const index = getHitPointIndex(dataPoints, point);
827
863
  if (index !== -1) {
828
864
  const handleIndex = index;
829
865
  if (index === 0) {
830
- return { handle: LineResizeHandle.source, handleIndex };
866
+ return { handle: ArrowLineResizeHandle.source, handleIndex };
831
867
  }
832
868
  if (index === dataPoints.length - 1) {
833
- return { handle: LineResizeHandle.target, handleIndex };
869
+ return { handle: ArrowLineResizeHandle.target, handleIndex };
834
870
  }
835
871
  // elbow line, data points only verify source connection point and target connection point
836
- if (element.shape !== LineShape.elbow) {
872
+ if (element.shape !== ArrowLineShape.elbow) {
837
873
  return { handleIndex };
838
874
  }
839
875
  }
@@ -841,7 +877,7 @@ const getHitLineResizeHandleRef = (board, element, point) => {
841
877
  const indexOfMiddlePoints = getHitPointIndex(middlePoints, point);
842
878
  if (indexOfMiddlePoints !== -1) {
843
879
  return {
844
- handle: LineResizeHandle.addHandle,
880
+ handle: ArrowLineResizeHandle.addHandle,
845
881
  handleIndex: indexOfMiddlePoints
846
882
  };
847
883
  }
@@ -861,11 +897,11 @@ function getHitPointIndex(points, movingPoint) {
861
897
  });
862
898
  return rectangle ? rectangles.indexOf(rectangle) : -1;
863
899
  }
864
- const getHitLineTextIndex = (board, element, point) => {
900
+ const getHitArrowLineTextIndex = (board, element, point) => {
865
901
  const texts = element.texts;
866
902
  if (!texts.length)
867
903
  return -1;
868
- const points = getLinePoints(board, element);
904
+ const points = getArrowLinePoints(board, element);
869
905
  return texts.findIndex(text => {
870
906
  const center = getPointOnPolyline(points, text.position);
871
907
  const rectangle = {
@@ -939,46 +975,46 @@ const isTextExceedingBounds = (geometry) => {
939
975
  }
940
976
  return false;
941
977
  };
942
- const isHitLineText = (board, element, point) => {
943
- return getHitLineTextIndex(board, element, point) !== -1;
978
+ const isHitArrowLineText = (board, element, point) => {
979
+ return getHitArrowLineTextIndex(board, element, point) !== -1;
944
980
  };
945
981
  const isHitPolyLine = (pathPoints, point) => {
946
982
  const distance = distanceBetweenPointAndSegments(pathPoints, point);
947
983
  return distance <= HIT_DISTANCE_BUFFER;
948
984
  };
949
- const isHitLine = (board, element, point) => {
950
- const points = getLinePoints(board, element);
951
- const isHitText = isHitLineText(board, element, point);
985
+ const isHitArrowLine = (board, element, point) => {
986
+ const points = getArrowLinePoints(board, element);
987
+ const isHitText = isHitArrowLineText(board, element, point);
952
988
  return isHitText || isHitPolyLine(points, point);
953
989
  };
954
- const isHitElementText = (element, point) => {
990
+ const isRectangleHitElementText = (element, rectangle) => {
955
991
  const engine = getEngine(element.shape);
956
992
  if (isMultipleTextGeometry(element)) {
957
993
  const texts = element.texts;
958
994
  return texts.some(item => {
959
995
  const textClient = engine.getTextRectangle(element, { key: item.key });
960
- return RectangleClient.isPointInRectangle(textClient, point);
996
+ const rotatedCornerPoints = rotatePointsByElement(RectangleClient.getCornerPoints(textClient), element) || RectangleClient.getCornerPoints(textClient);
997
+ return isPolylineHitRectangle(rotatedCornerPoints, rectangle);
961
998
  });
962
999
  }
963
1000
  else {
964
1001
  const textClient = engine.getTextRectangle ? engine.getTextRectangle(element) : getTextRectangle(element);
965
- return RectangleClient.isPointInRectangle(textClient, point);
1002
+ const rotatedCornerPoints = rotatePointsByElement(RectangleClient.getCornerPoints(textClient), element) || RectangleClient.getCornerPoints(textClient);
1003
+ return isPolylineHitRectangle(rotatedCornerPoints, rectangle);
966
1004
  }
967
1005
  };
968
- const isRectangleHitElementText = (element, rectangle) => {
1006
+ const isHitElementText = (element, point) => {
969
1007
  const engine = getEngine(element.shape);
970
1008
  if (isMultipleTextGeometry(element)) {
971
1009
  const texts = element.texts;
972
1010
  return texts.some(item => {
973
1011
  const textClient = engine.getTextRectangle(element, { key: item.key });
974
- const rotatedCornerPoints = rotatePointsByElement(RectangleClient.getCornerPoints(textClient), element) || RectangleClient.getCornerPoints(textClient);
975
- return isPolylineHitRectangle(rotatedCornerPoints, rectangle);
1012
+ return RectangleClient.isPointInRectangle(textClient, point);
976
1013
  });
977
1014
  }
978
1015
  else {
979
1016
  const textClient = engine.getTextRectangle ? engine.getTextRectangle(element) : getTextRectangle(element);
980
- const rotatedCornerPoints = rotatePointsByElement(RectangleClient.getCornerPoints(textClient), element) || RectangleClient.getCornerPoints(textClient);
981
- return isPolylineHitRectangle(rotatedCornerPoints, rectangle);
1017
+ return RectangleClient.isPointInRectangle(textClient, point);
982
1018
  }
983
1019
  };
984
1020
  const isRectangleHitDrawElement = (board, element, selection) => {
@@ -997,48 +1033,72 @@ const isRectangleHitDrawElement = (board, element, selection) => {
997
1033
  const rotatedCornerPoints = rotatePointsByElement(RectangleClient.getCornerPoints(client), element) || RectangleClient.getCornerPoints(client);
998
1034
  return isPolylineHitRectangle(rotatedCornerPoints, rangeRectangle);
999
1035
  }
1000
- if (PlaitDrawElement.isLine(element)) {
1001
- const points = getLinePoints(board, element);
1036
+ if (PlaitDrawElement.isArrowLine(element)) {
1037
+ const points = getArrowLinePoints(board, element);
1002
1038
  return isPolylineHitRectangle(points, rangeRectangle);
1003
1039
  }
1004
1040
  return null;
1005
1041
  };
1042
+ const getDrawHitElement = (board, elements) => {
1043
+ let firstFilledElement = getFirstFilledDrawElement(board, elements);
1044
+ let endIndex = elements.length;
1045
+ if (firstFilledElement) {
1046
+ endIndex = elements.indexOf(firstFilledElement) + 1;
1047
+ }
1048
+ const newElements = elements.slice(0, endIndex);
1049
+ const element = getFirstTextOrLineElement(newElements);
1050
+ if (element) {
1051
+ return element;
1052
+ }
1053
+ const sortElements = sortElementsByArea(board, newElements, 'asc');
1054
+ return sortElements[0];
1055
+ };
1056
+ const getFirstFilledDrawElement = (board, elements) => {
1057
+ let filledElement = null;
1058
+ for (let i = 0; i < elements.length; i++) {
1059
+ const element = elements[i];
1060
+ if (PlaitDrawElement.isGeometry(element) && !PlaitDrawElement.isText(element)) {
1061
+ const fill = getFillByElement(board, element);
1062
+ if (isFilled(fill)) {
1063
+ filledElement = element;
1064
+ break;
1065
+ }
1066
+ }
1067
+ }
1068
+ return filledElement;
1069
+ };
1070
+ const getFirstTextOrLineElement = (elements) => {
1071
+ const texts = elements.filter(item => PlaitDrawElement.isText(item));
1072
+ if (texts.length) {
1073
+ return texts[0];
1074
+ }
1075
+ const lines = elements.filter(item => PlaitDrawElement.isArrowLine(item));
1076
+ if (lines.length) {
1077
+ return lines[0];
1078
+ }
1079
+ return null;
1080
+ };
1006
1081
  const isHitDrawElement = (board, element, point) => {
1007
1082
  const rectangle = board.getRectangle(element);
1008
1083
  point = rotateAntiPointsByElement(point, element) || point;
1009
1084
  if (PlaitDrawElement.isGeometry(element)) {
1010
- const fill = getFillByElement(board, element);
1011
1085
  if (isHitEdgeOfShape(board, element, point, HIT_DISTANCE_BUFFER)) {
1012
1086
  return true;
1013
1087
  }
1014
1088
  const engine = getEngine(getElementShape(element));
1015
- // when shape equals text, fill is not allowed
1016
- if (fill !== DefaultDrawStyle.fill && fill !== TRANSPARENT && !PlaitDrawElement.isText(element)) {
1017
- const isHitInside = engine.isInsidePoint(rectangle, point);
1018
- if (isHitInside) {
1019
- return isHitInside;
1020
- }
1021
- }
1022
- else {
1023
- // if shape equals text, only check text rectangle
1024
- if (PlaitDrawElement.isText(element)) {
1025
- const textClient = getTextRectangle(element);
1026
- let isHitText = RectangleClient.isPointInRectangle(textClient, point);
1027
- return isHitText;
1028
- }
1029
- // check textRectangle of element
1030
- const isHitText = isHitElementText(element, point);
1031
- if (isHitText) {
1032
- return isHitText;
1033
- }
1089
+ if (PlaitDrawElement.isText(element)) {
1090
+ const textClient = getTextRectangle(element);
1091
+ return RectangleClient.isPointInRectangle(textClient, point);
1034
1092
  }
1093
+ const isHitText = isHitElementText(element, point);
1094
+ return isHitText || engine.isInsidePoint(rectangle, point);
1035
1095
  }
1036
1096
  if (PlaitDrawElement.isImage(element)) {
1037
1097
  const client = RectangleClient.getRectangleByPoints(element.points);
1038
1098
  return RectangleClient.isPointInRectangle(client, point);
1039
1099
  }
1040
- if (PlaitDrawElement.isLine(element)) {
1041
- return isHitLine(board, element, point);
1100
+ if (PlaitDrawElement.isArrowLine(element)) {
1101
+ return isHitArrowLine(board, element, point);
1042
1102
  }
1043
1103
  return null;
1044
1104
  };
@@ -1071,8 +1131,8 @@ const isHitElementInside = (board, element, point) => {
1071
1131
  const client = RectangleClient.getRectangleByPoints(element.points);
1072
1132
  return RectangleClient.isPointInRectangle(client, point);
1073
1133
  }
1074
- if (PlaitDrawElement.isLine(element)) {
1075
- return isHitLine(board, element, point);
1134
+ if (PlaitDrawElement.isArrowLine(element)) {
1135
+ return isHitArrowLine(board, element, point);
1076
1136
  }
1077
1137
  return null;
1078
1138
  };
@@ -1113,7 +1173,7 @@ const isDrawElementIncludeText = (element) => {
1113
1173
  if (PlaitDrawElement.isGeometry(element)) {
1114
1174
  return isGeometryIncludeText(element);
1115
1175
  }
1116
- if (PlaitDrawElement.isLine(element)) {
1176
+ if (PlaitDrawElement.isArrowLine(element)) {
1117
1177
  const editors = getTextEditorsByElement(element);
1118
1178
  return editors.length > 0;
1119
1179
  }
@@ -1259,13 +1319,13 @@ const LINE_AUTO_COMPLETE_HOVERED_DIAMETER = 10;
1259
1319
  const LINE_ALIGN_TOLERANCE = 3;
1260
1320
  const LINE_TEXT = '文本';
1261
1321
 
1262
- class LineShapeGenerator extends Generator {
1322
+ class ArrowLineShapeGenerator extends Generator {
1263
1323
  canDraw(element, data) {
1264
1324
  return true;
1265
1325
  }
1266
1326
  draw(element, data) {
1267
1327
  let lineG;
1268
- lineG = drawLine(this.board, element);
1328
+ lineG = drawArrowLine(this.board, element);
1269
1329
  return lineG;
1270
1330
  }
1271
1331
  }
@@ -1406,7 +1466,7 @@ function getIndexAndDeleteCountByKeyPoint(board, element, dataPoints, nextRender
1406
1466
  if (index === null) {
1407
1467
  deleteCount = 0;
1408
1468
  if (midDataPoints.length > 0) {
1409
- const handleRefPair = getLineHandleRefPair(board, element);
1469
+ const handleRefPair = getArrowLineHandleRefPair(board, element);
1410
1470
  const params = getElbowLineRouteOptions(board, element, handleRefPair);
1411
1471
  const keyPoints = removeDuplicatePoints(generateElbowLineRoute(params, board));
1412
1472
  const nextKeyPoints = simplifyOrthogonalPoints(keyPoints.slice(1, keyPoints.length - 1));
@@ -1576,9 +1636,9 @@ const hasIllegalElbowPoint = (midDataPoints) => {
1576
1636
  };
1577
1637
 
1578
1638
  const ARROW_LENGTH = 20;
1579
- const drawLineArrow = (element, points, options) => {
1639
+ const drawArrowLineArrow = (element, points, options) => {
1580
1640
  const arrowG = createG();
1581
- if (PlaitLine.isSourceMark(element, LineMarkerType.none) && PlaitLine.isTargetMark(element, LineMarkerType.none)) {
1641
+ if (PlaitArrowLine.isSourceMark(element, ArrowLineMarkerType.none) && PlaitArrowLine.isTargetMark(element, ArrowLineMarkerType.none)) {
1582
1642
  return null;
1583
1643
  }
1584
1644
  const strokeWidth = getStrokeWidthByElement(element);
@@ -1586,12 +1646,12 @@ const drawLineArrow = (element, points, options) => {
1586
1646
  if (points.length === 1) {
1587
1647
  points = [points[0], [points[0][0] + 0.1, points[0][1]]];
1588
1648
  }
1589
- if (!PlaitLine.isSourceMark(element, LineMarkerType.none)) {
1649
+ if (!PlaitArrowLine.isSourceMark(element, ArrowLineMarkerType.none)) {
1590
1650
  const source = getExtendPoint(points[0], points[1], ARROW_LENGTH + offset);
1591
1651
  const sourceArrow = getArrow(element, { marker: element.source.marker, source, target: points[0], isSource: true }, options);
1592
1652
  sourceArrow && arrowG.appendChild(sourceArrow);
1593
1653
  }
1594
- if (!PlaitLine.isTargetMark(element, LineMarkerType.none)) {
1654
+ if (!PlaitArrowLine.isTargetMark(element, ArrowLineMarkerType.none)) {
1595
1655
  const source = getExtendPoint(points[points.length - 1], points[points.length - 2], ARROW_LENGTH + offset);
1596
1656
  const arrow = getArrow(element, { marker: element.target.marker, source, target: points[points.length - 1], isSource: false }, options);
1597
1657
  arrow && arrowG.appendChild(arrow);
@@ -1602,35 +1662,35 @@ const getArrow = (element, arrowOptions, options) => {
1602
1662
  const { marker, target, source, isSource } = arrowOptions;
1603
1663
  let targetArrow;
1604
1664
  switch (marker) {
1605
- case LineMarkerType.openTriangle: {
1665
+ case ArrowLineMarkerType.openTriangle: {
1606
1666
  targetArrow = drawOpenTriangle(element, source, target, options);
1607
1667
  break;
1608
1668
  }
1609
- case LineMarkerType.solidTriangle: {
1669
+ case ArrowLineMarkerType.solidTriangle: {
1610
1670
  targetArrow = drawSolidTriangle(source, target, options);
1611
1671
  break;
1612
1672
  }
1613
- case LineMarkerType.arrow: {
1673
+ case ArrowLineMarkerType.arrow: {
1614
1674
  targetArrow = drawArrow(element, source, target, options);
1615
1675
  break;
1616
1676
  }
1617
- case LineMarkerType.sharpArrow: {
1677
+ case ArrowLineMarkerType.sharpArrow: {
1618
1678
  targetArrow = drawSharpArrow(source, target, options);
1619
1679
  break;
1620
1680
  }
1621
- case LineMarkerType.oneSideUp: {
1681
+ case ArrowLineMarkerType.oneSideUp: {
1622
1682
  targetArrow = drawOneSideArrow(source, target, isSource ? 'down' : 'up', options);
1623
1683
  break;
1624
1684
  }
1625
- case LineMarkerType.oneSideDown: {
1685
+ case ArrowLineMarkerType.oneSideDown: {
1626
1686
  targetArrow = drawOneSideArrow(source, target, isSource ? 'up' : 'down', options);
1627
1687
  break;
1628
1688
  }
1629
- case LineMarkerType.hollowTriangle: {
1689
+ case ArrowLineMarkerType.hollowTriangle: {
1630
1690
  targetArrow = drawHollowTriangleArrow(source, target, options);
1631
1691
  break;
1632
1692
  }
1633
- case LineMarkerType.singleSlash: {
1693
+ case ArrowLineMarkerType.singleSlash: {
1634
1694
  targetArrow = drawSingleSlash(source, target, isSource, options);
1635
1695
  break;
1636
1696
  }
@@ -1694,10 +1754,10 @@ const drawHollowTriangleArrow = (source, target, options) => {
1694
1754
  return drawLinearPath([pointLeft, pointRight, target], { ...options, fill: 'white' }, true);
1695
1755
  };
1696
1756
 
1697
- const createLineElement = (shape, points, source, target, texts, options) => {
1757
+ const createArrowLineElement = (shape, points, source, target, texts, options) => {
1698
1758
  return {
1699
1759
  id: idCreator(),
1700
- type: 'line',
1760
+ type: 'arrow-line',
1701
1761
  shape,
1702
1762
  source,
1703
1763
  texts: texts ? texts : [],
@@ -1707,17 +1767,17 @@ const createLineElement = (shape, points, source, target, texts, options) => {
1707
1767
  ...options
1708
1768
  };
1709
1769
  };
1710
- const getLinePoints = (board, element) => {
1770
+ const getArrowLinePoints = (board, element) => {
1711
1771
  switch (element.shape) {
1712
- case LineShape.elbow: {
1772
+ case ArrowLineShape.elbow: {
1713
1773
  return getElbowPoints(board, element);
1714
1774
  }
1715
- case LineShape.curve: {
1775
+ case ArrowLineShape.curve: {
1716
1776
  return getCurvePoints(board, element);
1717
1777
  }
1718
1778
  default: {
1719
- const points = PlaitLine.getPoints(board, element);
1720
- const handleRefPair = getLineHandleRefPair(board, element);
1779
+ const points = PlaitArrowLine.getPoints(board, element);
1780
+ const handleRefPair = getArrowLineHandleRefPair(board, element);
1721
1781
  points[0] = handleRefPair.source.point;
1722
1782
  points[points.length - 1] = handleRefPair.target.point;
1723
1783
  return points;
@@ -1726,7 +1786,7 @@ const getLinePoints = (board, element) => {
1726
1786
  };
1727
1787
  const getCurvePoints = (board, element) => {
1728
1788
  if (element.points.length === 2) {
1729
- const handleRefPair = getLineHandleRefPair(board, element);
1789
+ const handleRefPair = getArrowLineHandleRefPair(board, element);
1730
1790
  const { source, target } = handleRefPair;
1731
1791
  const sourceBoundElement = handleRefPair.source.boundElement;
1732
1792
  const targetBoundElement = handleRefPair.target.boundElement;
@@ -1753,7 +1813,7 @@ const getCurvePoints = (board, element) => {
1753
1813
  return pointsOnBezierCurves(curvePoints);
1754
1814
  }
1755
1815
  else {
1756
- let dataPoints = PlaitLine.getPoints(board, element);
1816
+ let dataPoints = PlaitArrowLine.getPoints(board, element);
1757
1817
  dataPoints = removeDuplicatePoints(dataPoints);
1758
1818
  const points = catmullRomFitting(dataPoints);
1759
1819
  return pointsOnBezierCurves(points);
@@ -1763,8 +1823,8 @@ function getMiddlePoints(board, element) {
1763
1823
  const result = [];
1764
1824
  const shape = element.shape;
1765
1825
  const hideBuffer = 10;
1766
- if (shape === LineShape.straight) {
1767
- const points = PlaitLine.getPoints(board, element);
1826
+ if (shape === ArrowLineShape.straight) {
1827
+ const points = PlaitArrowLine.getPoints(board, element);
1768
1828
  for (let i = 0; i < points.length - 1; i++) {
1769
1829
  const distance = distanceBetweenPointAndPoint(...points[i], ...points[i + 1]);
1770
1830
  if (distance < hideBuffer)
@@ -1772,8 +1832,8 @@ function getMiddlePoints(board, element) {
1772
1832
  result.push([(points[i][0] + points[i + 1][0]) / 2, (points[i][1] + points[i + 1][1]) / 2]);
1773
1833
  }
1774
1834
  }
1775
- if (shape === LineShape.curve) {
1776
- const points = PlaitLine.getPoints(board, element);
1835
+ if (shape === ArrowLineShape.curve) {
1836
+ const points = PlaitArrowLine.getPoints(board, element);
1777
1837
  const pointsOnBezier = getCurvePoints(board, element);
1778
1838
  if (points.length === 2) {
1779
1839
  const start = 0;
@@ -1793,7 +1853,7 @@ function getMiddlePoints(board, element) {
1793
1853
  }
1794
1854
  }
1795
1855
  }
1796
- if (shape === LineShape.elbow) {
1856
+ if (shape === ArrowLineShape.elbow) {
1797
1857
  const renderPoints = getElbowPoints(board, element);
1798
1858
  const options = getElbowLineRouteOptions(board, element);
1799
1859
  if (!isUseDefaultOrthogonalRoute(element, options)) {
@@ -1812,15 +1872,15 @@ function getMiddlePoints(board, element) {
1812
1872
  }
1813
1873
  return result;
1814
1874
  }
1815
- const drawLine = (board, element) => {
1875
+ const drawArrowLine = (board, element) => {
1816
1876
  const strokeWidth = getStrokeWidthByElement(element);
1817
1877
  const strokeColor = getStrokeColorByElement(board, element);
1818
1878
  const strokeLineDash = getLineDashByElement(element);
1819
1879
  const options = { stroke: strokeColor, strokeWidth, strokeLineDash };
1820
1880
  const lineG = createG();
1821
- let points = getLinePoints(board, element);
1881
+ let points = getArrowLinePoints(board, element);
1822
1882
  let line;
1823
- if (element.shape === LineShape.curve) {
1883
+ if (element.shape === ArrowLineShape.curve) {
1824
1884
  line = PlaitBoard.getRoughSVG(board).curve(points, options);
1825
1885
  }
1826
1886
  else {
@@ -1832,10 +1892,10 @@ const drawLine = (board, element) => {
1832
1892
  setStrokeLinecap(line, 'round');
1833
1893
  }
1834
1894
  lineG.appendChild(line);
1835
- const { mask, maskTargetFillRect } = drawMask(board, element, id);
1895
+ const { mask, maskTargetFillRect } = drawArrowLineMask(board, element, id);
1836
1896
  lineG.appendChild(mask);
1837
1897
  line.appendChild(maskTargetFillRect);
1838
- const arrow = drawLineArrow(element, points, { stroke: strokeColor, strokeWidth });
1898
+ const arrow = drawArrowLineArrow(element, points, { stroke: strokeColor, strokeWidth });
1839
1899
  arrow && lineG.appendChild(arrow);
1840
1900
  return lineG;
1841
1901
  };
@@ -1853,9 +1913,9 @@ const getHitConnectorPoint = (point, hitElement) => {
1853
1913
  return distanceBetweenPointAndPoint(...connectorPoint, ...point) <= LINE_SNAPPING_CONNECTOR_BUFFER;
1854
1914
  });
1855
1915
  };
1856
- const getLineTextRectangle = (board, element, index) => {
1916
+ const getArrowLineTextRectangle = (board, element, index) => {
1857
1917
  const text = element.texts[index];
1858
- const elbowPoints = getLinePoints(board, element);
1918
+ const elbowPoints = getArrowLinePoints(board, element);
1859
1919
  const point = getPointOnPolyline(elbowPoints, text.position);
1860
1920
  return {
1861
1921
  x: point[0] - text.width / 2,
@@ -1864,9 +1924,9 @@ const getLineTextRectangle = (board, element, index) => {
1864
1924
  height: text.height
1865
1925
  };
1866
1926
  };
1867
- const getLines = (board) => {
1927
+ const getArrowLines = (board) => {
1868
1928
  return findElements(board, {
1869
- match: (element) => PlaitDrawElement.isLine(element),
1929
+ match: (element) => PlaitDrawElement.isArrowLine(element),
1870
1930
  recursion: (element) => PlaitDrawElement.isDrawElement(element)
1871
1931
  });
1872
1932
  };
@@ -1886,33 +1946,33 @@ const Q2C = (points) => {
1886
1946
  }
1887
1947
  return result;
1888
1948
  };
1889
- const handleLineCreating = (board, lineShape, sourcePoint, movingPoint, sourceElement, lineShapeG) => {
1949
+ const handleArrowLineCreating = (board, lineShape, sourcePoint, movingPoint, sourceElement, lineShapeG) => {
1890
1950
  const hitElement = getSnappingShape(board, movingPoint);
1891
1951
  const targetConnection = hitElement ? getHitConnection(board, movingPoint, hitElement) : undefined;
1892
1952
  const sourceConnection = sourceElement ? getHitConnection(board, sourcePoint, sourceElement) : undefined;
1893
1953
  const targetBoundId = hitElement ? hitElement.id : undefined;
1894
- const lineGenerator = new LineShapeGenerator(board);
1954
+ const lineGenerator = new ArrowLineShapeGenerator(board);
1895
1955
  const memorizedLatest = getLineMemorizedLatest();
1896
1956
  let sourceMarker, targetMarker;
1897
1957
  sourceMarker = memorizedLatest.source;
1898
1958
  targetMarker = memorizedLatest.target;
1899
1959
  sourceMarker && delete memorizedLatest.source;
1900
1960
  targetMarker && delete memorizedLatest.target;
1901
- const temporaryLineElement = createLineElement(lineShape, [sourcePoint, movingPoint], { marker: sourceMarker || LineMarkerType.none, connection: sourceConnection, boundId: sourceElement?.id }, { marker: targetMarker || LineMarkerType.arrow, connection: targetConnection, boundId: targetBoundId }, [], {
1961
+ const temporaryLineElement = createArrowLineElement(lineShape, [sourcePoint, movingPoint], { marker: sourceMarker || ArrowLineMarkerType.none, connection: sourceConnection, boundId: sourceElement?.id }, { marker: targetMarker || ArrowLineMarkerType.arrow, connection: targetConnection, boundId: targetBoundId }, [], {
1902
1962
  strokeWidth: DefaultLineStyle.strokeWidth,
1903
1963
  ...memorizedLatest
1904
1964
  });
1905
- const linePoints = getLinePoints(board, temporaryLineElement);
1965
+ const linePoints = getArrowLinePoints(board, temporaryLineElement);
1906
1966
  const otherPoint = linePoints[0];
1907
1967
  temporaryLineElement.points[1] = alignPoints(otherPoint, movingPoint);
1908
1968
  lineGenerator.processDrawing(temporaryLineElement, lineShapeG);
1909
1969
  PlaitBoard.getElementActiveHost(board).append(lineShapeG);
1910
1970
  return temporaryLineElement;
1911
1971
  };
1912
- function drawMask(board, element, id) {
1972
+ function drawArrowLineMask(board, element, id) {
1913
1973
  const mask = createMask();
1914
1974
  mask.setAttribute('id', id);
1915
- const points = getLinePoints(board, element);
1975
+ const points = getArrowLinePoints(board, element);
1916
1976
  let rectangle = RectangleClient.getRectangleByPoints(points);
1917
1977
  rectangle = RectangleClient.getOutlineRectangle(rectangle, -30);
1918
1978
  const maskFillRect = createRect(rectangle, {
@@ -1921,7 +1981,7 @@ function drawMask(board, element, id) {
1921
1981
  mask.appendChild(maskFillRect);
1922
1982
  const texts = element.texts;
1923
1983
  texts.forEach((text, index) => {
1924
- let textRectangle = getLineTextRectangle(board, element, index);
1984
+ let textRectangle = getArrowLineTextRectangle(board, element, index);
1925
1985
  textRectangle = RectangleClient.inflate(textRectangle, LINE_TEXT_SPACE * 2);
1926
1986
  const rect = createRect(textRectangle, {
1927
1987
  fill: 'black'
@@ -2107,18 +2167,18 @@ const createDefaultFlowchart = (point) => {
2107
2167
  const processElement2 = createGeometryElement(FlowchartSymbols.process, getDefaultGeometryPoints(FlowchartSymbols.process, processPoint2), '过程', options);
2108
2168
  const endPoint = [decisionPoint[0], decisionPoint[1] + decisionProperty.height / 2 + 95 + terminalProperty.height / 2];
2109
2169
  const endElement = createGeometryElement(FlowchartSymbols.terminal, getDefaultGeometryPoints(FlowchartSymbols.terminal, endPoint), '结束', options);
2110
- const line1 = createLineElement(LineShape.elbow, [
2170
+ const line1 = createArrowLineElement(ArrowLineShape.elbow, [
2111
2171
  [0, 0],
2112
2172
  [0, 0]
2113
- ], { marker: LineMarkerType.none, connection: [0.5, 1], boundId: startElement.id }, { marker: LineMarkerType.arrow, connection: [0.5, 0], boundId: processElement1.id }, [], lineOptions);
2114
- const line2 = createLineElement(LineShape.elbow, [
2173
+ ], { marker: ArrowLineMarkerType.none, connection: [0.5, 1], boundId: startElement.id }, { marker: ArrowLineMarkerType.arrow, connection: [0.5, 0], boundId: processElement1.id }, [], lineOptions);
2174
+ const line2 = createArrowLineElement(ArrowLineShape.elbow, [
2115
2175
  [0, 0],
2116
2176
  [0, 0]
2117
- ], { marker: LineMarkerType.none, connection: [0.5, 1], boundId: processElement1.id }, { marker: LineMarkerType.arrow, connection: [0.5, 0], boundId: decisionElement.id }, [], lineOptions);
2118
- const line3 = createLineElement(LineShape.elbow, [
2177
+ ], { marker: ArrowLineMarkerType.none, connection: [0.5, 1], boundId: processElement1.id }, { marker: ArrowLineMarkerType.arrow, connection: [0.5, 0], boundId: decisionElement.id }, [], lineOptions);
2178
+ const line3 = createArrowLineElement(ArrowLineShape.elbow, [
2119
2179
  [0, 0],
2120
2180
  [0, 0]
2121
- ], { marker: LineMarkerType.none, connection: [0.5, 1], boundId: decisionElement.id }, { marker: LineMarkerType.arrow, connection: [0.5, 0], boundId: endElement.id }, [
2181
+ ], { marker: ArrowLineMarkerType.none, connection: [0.5, 1], boundId: decisionElement.id }, { marker: ArrowLineMarkerType.arrow, connection: [0.5, 0], boundId: endElement.id }, [
2122
2182
  {
2123
2183
  text: buildText('是'),
2124
2184
  position: 0.5,
@@ -2126,10 +2186,10 @@ const createDefaultFlowchart = (point) => {
2126
2186
  height: 20
2127
2187
  }
2128
2188
  ], lineOptions);
2129
- const line4 = createLineElement(LineShape.elbow, [
2189
+ const line4 = createArrowLineElement(ArrowLineShape.elbow, [
2130
2190
  [0, 0],
2131
2191
  [0, 0]
2132
- ], { marker: LineMarkerType.none, connection: [1, 0.5], boundId: decisionElement.id }, { marker: LineMarkerType.arrow, connection: [0, 0.5], boundId: processElement2.id }, [
2192
+ ], { marker: ArrowLineMarkerType.none, connection: [1, 0.5], boundId: decisionElement.id }, { marker: ArrowLineMarkerType.arrow, connection: [0, 0.5], boundId: processElement2.id }, [
2133
2193
  {
2134
2194
  text: buildText('否'),
2135
2195
  position: 0.5,
@@ -2137,10 +2197,10 @@ const createDefaultFlowchart = (point) => {
2137
2197
  height: 20
2138
2198
  }
2139
2199
  ], lineOptions);
2140
- const line5 = createLineElement(LineShape.elbow, [
2200
+ const line5 = createArrowLineElement(ArrowLineShape.elbow, [
2141
2201
  [0, 0],
2142
2202
  [0, 0]
2143
- ], { marker: LineMarkerType.none, connection: [0.5, 1], boundId: processElement2.id }, { marker: LineMarkerType.arrow, connection: [1, 0.5], boundId: endElement.id }, [], lineOptions);
2203
+ ], { marker: ArrowLineMarkerType.none, connection: [0.5, 1], boundId: processElement2.id }, { marker: ArrowLineMarkerType.arrow, connection: [1, 0.5], boundId: endElement.id }, [], lineOptions);
2144
2204
  return [startElement, processElement1, decisionElement, processElement2, endElement, line1, line2, line3, line4, line5];
2145
2205
  };
2146
2206
  const getAutoCompletePoints = (element) => {
@@ -2254,7 +2314,7 @@ const isUseDefaultOrthogonalRoute = (element, options) => {
2254
2314
  return isSourceAndTargetIntersect(options) && !isSelfLoop(element);
2255
2315
  };
2256
2316
  const getElbowPoints = (board, element) => {
2257
- const handleRefPair = getLineHandleRefPair(board, element);
2317
+ const handleRefPair = getArrowLineHandleRefPair(board, element);
2258
2318
  const params = getElbowLineRouteOptions(board, element, handleRefPair);
2259
2319
  // console.log(params, 'params');
2260
2320
  if (isUseDefaultOrthogonalRoute(element, params)) {
@@ -2267,7 +2327,7 @@ const getElbowPoints = (board, element) => {
2267
2327
  }
2268
2328
  else {
2269
2329
  const simplifiedNextKeyPoints = simplifyOrthogonalPoints(nextKeyPoints);
2270
- const dataPoints = removeDuplicatePoints(PlaitLine.getPoints(board, element));
2330
+ const dataPoints = removeDuplicatePoints(PlaitArrowLine.getPoints(board, element));
2271
2331
  const midDataPoints = dataPoints.slice(1, -1);
2272
2332
  if (hasIllegalElbowPoint(midDataPoints)) {
2273
2333
  return simplifyOrthogonalPoints(keyPoints);
@@ -2362,8 +2422,8 @@ const getSelectedGeometryElements = (board) => {
2362
2422
  const selectedElements = getSelectedElements(board).filter(value => PlaitDrawElement.isGeometry(value));
2363
2423
  return selectedElements;
2364
2424
  };
2365
- const getSelectedLineElements = (board) => {
2366
- const selectedElements = getSelectedElements(board).filter(value => PlaitDrawElement.isLine(value));
2425
+ const getSelectedArrowLineElements = (board) => {
2426
+ const selectedElements = getSelectedElements(board).filter(value => PlaitDrawElement.isArrowLine(value));
2367
2427
  return selectedElements;
2368
2428
  };
2369
2429
  const getSelectedImageElements = (board) => {
@@ -2379,32 +2439,32 @@ const getSelectedSwimlane = (board) => {
2379
2439
  return selectedElements.find(item => PlaitDrawElement.isSwimlane(item));
2380
2440
  };
2381
2441
 
2382
- const resizeLine = (board, options, path) => {
2442
+ const resizeArrowLine = (board, options, path) => {
2383
2443
  Transforms.setNode(board, options, path);
2384
2444
  };
2385
- const setLineTexts = (board, element, texts) => {
2445
+ const setArrowLineTexts = (board, element, texts) => {
2386
2446
  const path = PlaitBoard.findPath(board, element);
2387
2447
  Transforms.setNode(board, { texts }, path);
2388
2448
  };
2389
- const removeLineText = (board, element, index) => {
2449
+ const removeArrowLineText = (board, element, index) => {
2390
2450
  const path = PlaitBoard.findPath(board, element);
2391
2451
  const texts = element.texts?.length ? [...element.texts] : [];
2392
2452
  const newTexts = [...texts];
2393
2453
  newTexts.splice(index, 1);
2394
2454
  Transforms.setNode(board, { texts: newTexts }, path);
2395
2455
  };
2396
- const setLineMark = (board, handleKey, marker) => {
2397
- memorizeLatest(MemorizeKey.line, handleKey, marker);
2398
- const selectedElements = getSelectedLineElements(board);
2456
+ const setArrowLineMark = (board, handleKey, marker) => {
2457
+ memorizeLatest(MemorizeKey.arrowLine, handleKey, marker);
2458
+ const selectedElements = getSelectedArrowLineElements(board);
2399
2459
  selectedElements.forEach((element) => {
2400
2460
  const path = PlaitBoard.findPath(board, element);
2401
- let handle = handleKey === LineHandleKey.source ? element.source : element.target;
2461
+ let handle = handleKey === ArrowLineHandleKey.source ? element.source : element.target;
2402
2462
  handle = { ...handle, marker };
2403
2463
  Transforms.setNode(board, { [handleKey]: handle }, path);
2404
2464
  });
2405
2465
  };
2406
- const setLineShape = (board, newProperties) => {
2407
- const elements = getSelectedLineElements(board);
2466
+ const setArrowLineShape = (board, newProperties) => {
2467
+ const elements = getSelectedArrowLineElements(board);
2408
2468
  elements.map(element => {
2409
2469
  const _properties = { ...newProperties };
2410
2470
  if (element.shape === newProperties.shape) {
@@ -2414,10 +2474,10 @@ const setLineShape = (board, newProperties) => {
2414
2474
  Transforms.setNode(board, _properties, path);
2415
2475
  });
2416
2476
  };
2417
- const collectLineUpdatedRefsByGeometry = (board, geometry, refs) => {
2477
+ const collectArrowLineUpdatedRefsByGeometry = (board, geometry, refs) => {
2418
2478
  const lines = findElements(board, {
2419
2479
  match: (element) => {
2420
- if (PlaitDrawElement.isLine(element)) {
2480
+ if (PlaitDrawElement.isArrowLine(element)) {
2421
2481
  return element.source.boundId === geometry.id || element.target.boundId === geometry.id;
2422
2482
  }
2423
2483
  return false;
@@ -2429,7 +2489,7 @@ const collectLineUpdatedRefsByGeometry = (board, geometry, refs) => {
2429
2489
  const isSourceBound = line.source.boundId === geometry.id;
2430
2490
  const handle = isSourceBound ? 'source' : 'target';
2431
2491
  const object = { ...line[handle] };
2432
- const linePoints = getLinePoints(board, line);
2492
+ const linePoints = getArrowLinePoints(board, line);
2433
2493
  const point = isSourceBound ? linePoints[0] : linePoints[linePoints.length - 1];
2434
2494
  object.connection = getHitConnection(board, point, geometry);
2435
2495
  const path = PlaitBoard.findPath(board, line);
@@ -2448,14 +2508,14 @@ const collectLineUpdatedRefsByGeometry = (board, geometry, refs) => {
2448
2508
  });
2449
2509
  }
2450
2510
  };
2451
- const connectLineToGeometry = (board, lineElement, handle, geometryElement) => {
2452
- const linePoints = PlaitLine.getPoints(board, lineElement);
2453
- const point = handle === LineHandleKey.source ? linePoints[0] : linePoints[linePoints.length - 1];
2511
+ const connectArrowLineToGeometry = (board, lineElement, handle, geometryElement) => {
2512
+ const linePoints = PlaitArrowLine.getPoints(board, lineElement);
2513
+ const point = handle === ArrowLineHandleKey.source ? linePoints[0] : linePoints[linePoints.length - 1];
2454
2514
  const connection = getHitConnection(board, point, geometryElement);
2455
2515
  if (connection) {
2456
2516
  let source = lineElement.source;
2457
2517
  let target = lineElement.target;
2458
- if (handle === LineHandleKey.source) {
2518
+ if (handle === ArrowLineHandleKey.source) {
2459
2519
  source = {
2460
2520
  ...source,
2461
2521
  boundId: geometryElement.id,
@@ -2470,7 +2530,7 @@ const connectLineToGeometry = (board, lineElement, handle, geometryElement) => {
2470
2530
  };
2471
2531
  }
2472
2532
  const path = PlaitBoard.findPath(board, lineElement);
2473
- resizeLine(board, { source, target }, path);
2533
+ resizeArrowLine(board, { source, target }, path);
2474
2534
  }
2475
2535
  };
2476
2536
 
@@ -2523,12 +2583,12 @@ const switchGeometryShape = (board, shape) => {
2523
2583
  if (PlaitDrawElement.isGeometry(item) && !PlaitDrawElement.isText(item)) {
2524
2584
  const path = PlaitBoard.findPath(board, item);
2525
2585
  Transforms.setNode(board, { shape }, path);
2526
- collectLineUpdatedRefsByGeometry(board, { ...item, shape }, refs);
2586
+ collectArrowLineUpdatedRefsByGeometry(board, { ...item, shape }, refs);
2527
2587
  }
2528
2588
  });
2529
2589
  if (refs.length) {
2530
2590
  refs.forEach(ref => {
2531
- DrawTransforms.resizeLine(board, ref.property, ref.path);
2591
+ DrawTransforms.resizeArrowLine(board, ref.property, ref.path);
2532
2592
  });
2533
2593
  }
2534
2594
  };
@@ -2649,8 +2709,10 @@ const getDefaultSwimlanePoints = (pointer, centerPoint) => {
2649
2709
  const createDefaultSwimlane = (shape, points) => {
2650
2710
  const header = isSwimlaneWithHeader(shape);
2651
2711
  const dataShape = adjustSwimlaneShape(shape);
2652
- const rows = createDefaultRowsOrColumns(dataShape, 'row', header);
2653
- const columns = createDefaultRowsOrColumns(dataShape, 'column', header);
2712
+ const width = points[1][0] - points[0][0];
2713
+ const height = points[1][1] - points[0][1];
2714
+ const rows = createDefaultRowsOrColumns(dataShape, 'row', header, height);
2715
+ const columns = createDefaultRowsOrColumns(dataShape, 'column', header, width);
2654
2716
  const swimlane = {
2655
2717
  id: idCreator(),
2656
2718
  type: 'swimlane',
@@ -2663,18 +2725,22 @@ const createDefaultSwimlane = (shape, points) => {
2663
2725
  };
2664
2726
  return swimlane;
2665
2727
  };
2666
- const createDefaultRowsOrColumns = (shape, type, header) => {
2728
+ const createDefaultRowsOrColumns = (shape, type, header, size) => {
2667
2729
  const createItems = (count) => new Array(count).fill('').map(() => ({ id: idCreator() }));
2668
2730
  let data = createItems(3);
2669
2731
  if ((type === 'row' && shape === SwimlaneSymbols.swimlaneVertical) ||
2670
2732
  (type === 'column' && shape === SwimlaneSymbols.swimlaneHorizontal)) {
2671
2733
  data = header ? data : createItems(2);
2672
2734
  const dimension = type === 'row' ? 'height' : 'width';
2735
+ let defaultSize = SWIMLANE_HEADER_SIZE;
2736
+ if (size < SWIMLANE_HEADER_SIZE * data.length) {
2737
+ defaultSize = Math.min((size / data.length / SWIMLANE_HEADER_SIZE) * SWIMLANE_HEADER_SIZE, SWIMLANE_HEADER_SIZE);
2738
+ }
2673
2739
  data = data.map((item, index) => {
2674
2740
  if (index === 0 || (index === 1 && header)) {
2675
2741
  return {
2676
2742
  ...item,
2677
- [dimension]: SWIMLANE_HEADER_SIZE
2743
+ [dimension]: defaultSize
2678
2744
  };
2679
2745
  }
2680
2746
  return item;
@@ -2877,33 +2943,6 @@ const updateSwimlane = (board, swimlane, newColumns, newRows, newCells, newPoint
2877
2943
  points: newPoints
2878
2944
  }, path);
2879
2945
  };
2880
- const setSwimlaneFill = (board, element, fill, path) => {
2881
- const selectedCells = getSelectedCells(element);
2882
- let newCells = element.cells;
2883
- if (selectedCells?.length) {
2884
- newCells = element.cells.map(cell => {
2885
- if (selectedCells.map(item => item.id).includes(cell.id)) {
2886
- return {
2887
- ...cell,
2888
- fill
2889
- };
2890
- }
2891
- return cell;
2892
- });
2893
- }
2894
- else {
2895
- newCells = element.cells.map(cell => {
2896
- if (cell.text && cell.textHeight) {
2897
- return {
2898
- ...cell,
2899
- fill
2900
- };
2901
- }
2902
- return cell;
2903
- });
2904
- }
2905
- Transforms.setNode(board, { cells: newCells }, path);
2906
- };
2907
2946
 
2908
2947
  const setDrawShapeText = (board, element, text) => {
2909
2948
  const newTexts = element.texts?.map(item => {
@@ -2919,7 +2958,8 @@ const setDrawShapeText = (board, element, text) => {
2919
2958
  Transforms.setNode(board, newElement, [path]);
2920
2959
  };
2921
2960
 
2922
- const setTableText = (board, table, cellId, text, textWidth, textHeight) => {
2961
+ const setTableText = (board, path, cellId, text, textHeight) => {
2962
+ const table = PlaitNode.get(board, path);
2923
2963
  const cell = getCellWithPoints(board, table, cellId);
2924
2964
  const cellIndex = table.cells.findIndex(item => item.id === cell.id);
2925
2965
  let rows = [...table.rows];
@@ -2955,8 +2995,35 @@ const setTableText = (board, table, cellId, text, textWidth, textHeight) => {
2955
2995
  textHeight: textHeight,
2956
2996
  text
2957
2997
  };
2958
- const path = board.children.findIndex(child => child.id === table.id);
2959
- Transforms.setNode(board, { rows, columns, cells, points }, [path]);
2998
+ Transforms.setNode(board, { rows, columns, cells, points }, path);
2999
+ };
3000
+
3001
+ const setTableFill = (board, element, fill, path) => {
3002
+ const selectedCells = getSelectedCells(element);
3003
+ let newCells = element.cells;
3004
+ if (selectedCells?.length) {
3005
+ newCells = element.cells.map(cell => {
3006
+ if (selectedCells.map(item => item.id).includes(cell.id)) {
3007
+ return {
3008
+ ...cell,
3009
+ fill
3010
+ };
3011
+ }
3012
+ return cell;
3013
+ });
3014
+ }
3015
+ else {
3016
+ newCells = element.cells.map(cell => {
3017
+ if (cell.text && cell.textHeight) {
3018
+ return {
3019
+ ...cell,
3020
+ fill
3021
+ };
3022
+ }
3023
+ return cell;
3024
+ });
3025
+ }
3026
+ Transforms.setNode(board, { cells: newCells }, path);
2960
3027
  };
2961
3028
 
2962
3029
  const DrawTransforms = {
@@ -2966,22 +3033,22 @@ const DrawTransforms = {
2966
3033
  resizeGeometry,
2967
3034
  insertText,
2968
3035
  setTextSize,
2969
- resizeLine,
2970
- setLineTexts,
2971
- removeLineText,
2972
- setLineMark,
2973
- setLineShape,
3036
+ resizeArrowLine,
3037
+ setArrowLineTexts,
3038
+ removeArrowLineText,
3039
+ setArrowLineMark,
3040
+ setArrowLineShape,
2974
3041
  insertImage,
2975
3042
  switchGeometryShape,
2976
- connectLineToGeometry,
3043
+ connectArrowLineToGeometry,
2977
3044
  insertGeometryByVector,
2978
3045
  setTableText,
2979
3046
  addSwimlaneRow,
2980
3047
  addSwimlaneColumn,
2981
3048
  removeSwimlaneRow,
2982
3049
  removeSwimlaneColumn,
2983
- setSwimlaneFill,
2984
- updateSwimlaneCount
3050
+ updateSwimlaneCount,
3051
+ setTableFill
2985
3052
  };
2986
3053
 
2987
3054
  const getHitRectangleResizeHandleRef = (board, rectangle, point, angle = 0) => {
@@ -3116,10 +3183,16 @@ function withDrawResize(board) {
3116
3183
  }
3117
3184
  }
3118
3185
  if (PlaitDrawElement.isGeometry(target)) {
3119
- const { height: textHeight } = getFirstTextManage(target).getSize();
3120
- DrawTransforms.resizeGeometry(board, points, textHeight, path);
3186
+ if (isGeometryIncludeText(target)) {
3187
+ const { height: textHeight } = getFirstTextManage(target).getSize();
3188
+ DrawTransforms.resizeGeometry(board, points, textHeight, path);
3189
+ }
3190
+ else {
3191
+ points = normalizeShapePoints(points);
3192
+ Transforms.setNode(board, { points }, path);
3193
+ }
3121
3194
  }
3122
- else if (PlaitDrawElement.isLine(target)) {
3195
+ else if (PlaitDrawElement.isArrowLine(target)) {
3123
3196
  Transforms.setNode(board, { points }, path);
3124
3197
  }
3125
3198
  else if (PlaitDrawElement.isImage(target)) {
@@ -3438,29 +3511,6 @@ function drawIsometricSnapLines(board, activePoints, snapRectangles, resizeSnapO
3438
3511
  return drawSolidLines(board, isometricLines);
3439
3512
  }
3440
3513
 
3441
- const isSingleSelectTable = (board) => {
3442
- const selectedElements = getSelectedElements(board);
3443
- return selectedElements && selectedElements.length === 1 && PlaitTableElement.isTable(selectedElements[0]);
3444
- };
3445
- const isSingleSelectElementByTable = (board) => {
3446
- const selectedElements = getSelectedElements(board);
3447
- return selectedElements && selectedElements.length === 1 && PlaitDrawElement.isElementByTable(selectedElements[0]);
3448
- };
3449
- const getSelectedTableElements = (board, elements) => {
3450
- const selectedElements = elements?.length ? elements : getSelectedElements(board);
3451
- return selectedElements.filter(value => PlaitTableElement.isTable(value));
3452
- };
3453
- const SELECTED_CELLS = new WeakMap();
3454
- function getSelectedCells(element) {
3455
- return SELECTED_CELLS.get(element);
3456
- }
3457
- function setSelectedCells(element, cells) {
3458
- return SELECTED_CELLS.set(element, cells);
3459
- }
3460
- function clearSelectedCells(element) {
3461
- return SELECTED_CELLS.delete(element);
3462
- }
3463
-
3464
3514
  const getCenterPointsOnPolygon = (points) => {
3465
3515
  const centerPoints = [];
3466
3516
  for (let i = 0; i < points.length; i++) {
@@ -5023,7 +5073,7 @@ const NoteCurlyLeftEngine = {
5023
5073
  ${rectangle.x + rectangle.width - rectangle.width * 0.09} ${rectangle.y + rectangle.height / 2}
5024
5074
  C${rectangle.x + rectangle.width} ${rectangle.y + rectangle.height / 2},
5025
5075
  ${rectangle.x + rectangle.width - rectangle.width * 0.09} ${rectangle.y + rectangle.height},
5026
- ${rectangle.x + rectangle.width} ${rectangle.y + rectangle.height}`, { ...options, fillStyle: 'solid' });
5076
+ ${rectangle.x + rectangle.width} ${rectangle.y + rectangle.height}`, { ...options, fillStyle: 'solid', fill: 'transparent' });
5027
5077
  setStrokeLinecap(shape, 'round');
5028
5078
  return shape;
5029
5079
  },
@@ -5062,13 +5112,13 @@ const NoteCurlyLeftEngine = {
5062
5112
  const NoteCurlyRightEngine = {
5063
5113
  draw(board, rectangle, options) {
5064
5114
  const rs = PlaitBoard.getRoughSVG(board);
5065
- const shape = rs.path(`M${rectangle.x} ${rectangle.y}
5066
- C${rectangle.x + rectangle.width * 0.09} ${rectangle.y},
5067
- ${rectangle.x} ${rectangle.y + rectangle.height / 2},
5115
+ const shape = rs.path(`M${rectangle.x} ${rectangle.y}
5116
+ C${rectangle.x + rectangle.width * 0.09} ${rectangle.y},
5117
+ ${rectangle.x} ${rectangle.y + rectangle.height / 2},
5068
5118
  ${rectangle.x + rectangle.width * 0.09} ${rectangle.y + rectangle.height / 2}
5069
- C${rectangle.x} ${rectangle.y + rectangle.height / 2},
5070
- ${rectangle.x + rectangle.width * 0.09} ${rectangle.y + rectangle.height},
5071
- ${rectangle.x} ${rectangle.y + rectangle.height}`, { ...options, fillStyle: 'solid' });
5119
+ C${rectangle.x} ${rectangle.y + rectangle.height / 2},
5120
+ ${rectangle.x + rectangle.width * 0.09} ${rectangle.y + rectangle.height},
5121
+ ${rectangle.x} ${rectangle.y + rectangle.height}`, { ...options, fillStyle: 'solid', fill: 'transparent' });
5072
5122
  setStrokeLinecap(shape, 'round');
5073
5123
  return shape;
5074
5124
  },
@@ -5109,7 +5159,7 @@ const NoteSquareEngine = {
5109
5159
  const rs = PlaitBoard.getRoughSVG(board);
5110
5160
  const shape = rs.path(`M${rectangle.x + rectangle.width * 0.075} ${rectangle.y + rectangle.height} H${rectangle.x} V${rectangle.y} H${rectangle.x +
5111
5161
  rectangle.width * 0.075}
5112
- `, { ...options, fillStyle: 'solid' });
5162
+ `, { ...options, fillStyle: 'solid', fill: 'transparent' });
5113
5163
  setStrokeLinecap(shape, 'round');
5114
5164
  return shape;
5115
5165
  },
@@ -5222,8 +5272,8 @@ const TableEngine = {
5222
5272
  const rs = PlaitBoard.getRoughSVG(board);
5223
5273
  const g = createG();
5224
5274
  const { x, y, width, height } = rectangle;
5225
- const tableTopBorder = drawLine$1(rs, [x, y], [x + width, y], roughOptions);
5226
- const tableLeftBorder = drawLine$1(rs, [x, y], [x, y + height], roughOptions);
5275
+ const tableTopBorder = drawLine(rs, [x, y], [x + width, y], roughOptions);
5276
+ const tableLeftBorder = drawLine(rs, [x, y], [x, y + height], roughOptions);
5227
5277
  g.append(tableTopBorder, tableLeftBorder);
5228
5278
  const pointCells = getCellsWithPoints(board, { ...options?.element });
5229
5279
  pointCells.forEach(cell => {
@@ -5235,8 +5285,8 @@ const TableEngine = {
5235
5285
  width: width - ACTIVE_STROKE_WIDTH * 2,
5236
5286
  height: height - ACTIVE_STROKE_WIDTH * 2
5237
5287
  }, { fill: cell.fill, fillStyle: 'solid', strokeWidth: 0 });
5238
- const cellRightBorder = drawLine$1(rs, [x + width, y], [x + width, y + height], roughOptions);
5239
- const cellBottomBorder = drawLine$1(rs, [x, y + height], [x + width, y + height], roughOptions);
5288
+ const cellRightBorder = drawLine(rs, [x + width, y], [x + width, y + height], roughOptions);
5289
+ const cellBottomBorder = drawLine(rs, [x, y + height], [x + width, y + height], roughOptions);
5240
5290
  g.append(cellRectangle, cellRightBorder, cellBottomBorder);
5241
5291
  });
5242
5292
  setStrokeLinecap(g, 'round');
@@ -5742,7 +5792,8 @@ const RequiredInterfaceEngine = {
5742
5792
  M${rectangle.x + rectangle.width * 0.41} ${rectangle.y + rectangle.height / 2} H${rectangle.x + rectangle.width}
5743
5793
  `, {
5744
5794
  ...options,
5745
- fillStyle: 'solid'
5795
+ fillStyle: 'solid',
5796
+ fill: 'transparent'
5746
5797
  });
5747
5798
  setStrokeLinecap(shape, 'round');
5748
5799
  return shape;
@@ -6050,7 +6101,7 @@ const getEngine = (shape) => {
6050
6101
  return ShapeEngineMap[shape];
6051
6102
  };
6052
6103
 
6053
- const getLineHandleRefPair = (board, element) => {
6104
+ const getArrowLineHandleRefPair = (board, element) => {
6054
6105
  const strokeWidth = getStrokeWidthByElement(element);
6055
6106
  const sourceBoundElement = element.source.boundId ? getElementById(board, element.source.boundId) : undefined;
6056
6107
  const targetBoundElement = element.target.boundId ? getElementById(board, element.target.boundId) : undefined;
@@ -6063,19 +6114,21 @@ const getLineHandleRefPair = (board, element) => {
6063
6114
  const sourceFactor = getDirectionFactor(sourceDirection);
6064
6115
  const targetFactor = getDirectionFactor(targetDirection);
6065
6116
  const sourceHandleRef = {
6066
- key: LineHandleKey.source,
6117
+ key: ArrowLineHandleKey.source,
6067
6118
  point: sourcePoint,
6068
6119
  direction: sourceDirection,
6069
6120
  vector: [sourceFactor.x, sourceFactor.y]
6070
6121
  };
6071
6122
  const targetHandleRef = {
6072
- key: LineHandleKey.target,
6123
+ key: ArrowLineHandleKey.target,
6073
6124
  point: targetPoint,
6074
6125
  direction: targetDirection,
6075
6126
  vector: [targetFactor.x, targetFactor.y]
6076
6127
  };
6077
6128
  if (sourceBoundElement) {
6078
- const connectionOffset = PlaitLine.isSourceMarkOrTargetMark(element, LineMarkerType.none, LineHandleKey.source) ? 0 : strokeWidth;
6129
+ const connectionOffset = PlaitArrowLine.isSourceMarkOrTargetMark(element, ArrowLineMarkerType.none, ArrowLineHandleKey.source)
6130
+ ? 0
6131
+ : strokeWidth;
6079
6132
  const sourceVector = getVectorByConnection(sourceBoundElement, element.source.connection);
6080
6133
  sourceHandleRef.vector = sourceVector;
6081
6134
  sourceHandleRef.boundElement = sourceBoundElement;
@@ -6092,7 +6145,9 @@ const getLineHandleRefPair = (board, element) => {
6092
6145
  sourceHandleRef.point = rotatePointsByElement(sourcePoint, sourceBoundElement) || sourcePoint;
6093
6146
  }
6094
6147
  if (targetBoundElement) {
6095
- const connectionOffset = PlaitLine.isSourceMarkOrTargetMark(element, LineMarkerType.none, LineHandleKey.target) ? 0 : strokeWidth;
6148
+ const connectionOffset = PlaitArrowLine.isSourceMarkOrTargetMark(element, ArrowLineMarkerType.none, ArrowLineHandleKey.target)
6149
+ ? 0
6150
+ : strokeWidth;
6096
6151
  const targetVector = getVectorByConnection(targetBoundElement, element.target.connection);
6097
6152
  targetHandleRef.vector = targetVector;
6098
6153
  targetHandleRef.boundElement = targetBoundElement;
@@ -6147,7 +6202,7 @@ const getVectorByConnection = (boundElement, connection) => {
6147
6202
  return vector;
6148
6203
  };
6149
6204
  const getElbowLineRouteOptions = (board, element, handleRefPair) => {
6150
- handleRefPair = handleRefPair ?? getLineHandleRefPair(board, element);
6205
+ handleRefPair = handleRefPair ?? getArrowLineHandleRefPair(board, element);
6151
6206
  const { sourceRectangle, targetRectangle } = getSourceAndTargetRectangle(board, element, handleRefPair);
6152
6207
  const { sourceOuterRectangle, targetOuterRectangle } = getSourceAndTargetOuterRectangle(sourceRectangle, targetRectangle);
6153
6208
  const sourcePoint = handleRefPair.source.point;
@@ -6166,32 +6221,32 @@ const getElbowLineRouteOptions = (board, element, handleRefPair) => {
6166
6221
  };
6167
6222
  };
6168
6223
 
6169
- var LineMarkerType;
6170
- (function (LineMarkerType) {
6171
- LineMarkerType["arrow"] = "arrow";
6172
- LineMarkerType["none"] = "none";
6173
- LineMarkerType["openTriangle"] = "open-triangle";
6174
- LineMarkerType["solidTriangle"] = "solid-triangle";
6175
- LineMarkerType["sharpArrow"] = "sharp-arrow";
6176
- LineMarkerType["oneSideUp"] = "one-side-up";
6177
- LineMarkerType["oneSideDown"] = "one-side-down";
6178
- LineMarkerType["hollowTriangle"] = "hollow-triangle";
6179
- LineMarkerType["singleSlash"] = "single-slash";
6180
- })(LineMarkerType || (LineMarkerType = {}));
6181
- var LineShape;
6182
- (function (LineShape) {
6183
- LineShape["straight"] = "straight";
6184
- LineShape["curve"] = "curve";
6185
- LineShape["elbow"] = "elbow";
6186
- })(LineShape || (LineShape = {}));
6187
- var LineHandleKey;
6188
- (function (LineHandleKey) {
6189
- LineHandleKey["source"] = "source";
6190
- LineHandleKey["target"] = "target";
6191
- })(LineHandleKey || (LineHandleKey = {}));
6192
- const PlaitLine = {
6224
+ var ArrowLineMarkerType;
6225
+ (function (ArrowLineMarkerType) {
6226
+ ArrowLineMarkerType["arrow"] = "arrow";
6227
+ ArrowLineMarkerType["none"] = "none";
6228
+ ArrowLineMarkerType["openTriangle"] = "open-triangle";
6229
+ ArrowLineMarkerType["solidTriangle"] = "solid-triangle";
6230
+ ArrowLineMarkerType["sharpArrow"] = "sharp-arrow";
6231
+ ArrowLineMarkerType["oneSideUp"] = "one-side-up";
6232
+ ArrowLineMarkerType["oneSideDown"] = "one-side-down";
6233
+ ArrowLineMarkerType["hollowTriangle"] = "hollow-triangle";
6234
+ ArrowLineMarkerType["singleSlash"] = "single-slash";
6235
+ })(ArrowLineMarkerType || (ArrowLineMarkerType = {}));
6236
+ var ArrowLineShape;
6237
+ (function (ArrowLineShape) {
6238
+ ArrowLineShape["straight"] = "straight";
6239
+ ArrowLineShape["curve"] = "curve";
6240
+ ArrowLineShape["elbow"] = "elbow";
6241
+ })(ArrowLineShape || (ArrowLineShape = {}));
6242
+ var ArrowLineHandleKey;
6243
+ (function (ArrowLineHandleKey) {
6244
+ ArrowLineHandleKey["source"] = "source";
6245
+ ArrowLineHandleKey["target"] = "target";
6246
+ })(ArrowLineHandleKey || (ArrowLineHandleKey = {}));
6247
+ const PlaitArrowLine = {
6193
6248
  isSourceMarkOrTargetMark(line, markType, handleKey) {
6194
- if (handleKey === LineHandleKey.source) {
6249
+ if (handleKey === ArrowLineHandleKey.source) {
6195
6250
  return line.source.marker === markType;
6196
6251
  }
6197
6252
  else {
@@ -6199,10 +6254,10 @@ const PlaitLine = {
6199
6254
  }
6200
6255
  },
6201
6256
  isSourceMark(line, markType) {
6202
- return PlaitLine.isSourceMarkOrTargetMark(line, markType, LineHandleKey.source);
6257
+ return PlaitArrowLine.isSourceMarkOrTargetMark(line, markType, ArrowLineHandleKey.source);
6203
6258
  },
6204
6259
  isTargetMark(line, markType) {
6205
- return PlaitLine.isSourceMarkOrTargetMark(line, markType, LineHandleKey.target);
6260
+ return PlaitArrowLine.isSourceMarkOrTargetMark(line, markType, ArrowLineHandleKey.target);
6206
6261
  },
6207
6262
  isBoundElementOfSource(line, element) {
6208
6263
  return line.source.boundId === element.id;
@@ -6245,16 +6300,25 @@ var MemorizeKey;
6245
6300
  MemorizeKey["basicShape"] = "basicShape";
6246
6301
  MemorizeKey["flowchart"] = "flowchart";
6247
6302
  MemorizeKey["text"] = "text";
6248
- MemorizeKey["line"] = "line";
6303
+ MemorizeKey["arrowLine"] = "arrow-line";
6249
6304
  MemorizeKey["UML"] = "UML";
6250
6305
  })(MemorizeKey || (MemorizeKey = {}));
6251
6306
 
6307
+ var VectorLineShape;
6308
+ (function (VectorLineShape) {
6309
+ VectorLineShape["straight"] = "straight";
6310
+ VectorLineShape["curve"] = "curve";
6311
+ })(VectorLineShape || (VectorLineShape = {}));
6312
+
6252
6313
  const PlaitDrawElement = {
6253
6314
  isGeometry: (value) => {
6254
6315
  return value.type === 'geometry';
6255
6316
  },
6256
- isLine: (value) => {
6257
- return value.type === 'line';
6317
+ // isLine: (value: any): value is PlaitArrowLine => {
6318
+ // return value.type === 'arrow-line' || value.type === 'line' || value.type === 'vector-line';
6319
+ // },
6320
+ isArrowLine: (value) => {
6321
+ return value.type === 'arrow-line' || value.type === 'line';
6258
6322
  },
6259
6323
  isText: (value) => {
6260
6324
  return value.type === 'geometry' && value.shape === BasicShapes.text;
@@ -6267,7 +6331,7 @@ const PlaitDrawElement = {
6267
6331
  },
6268
6332
  isDrawElement: (value) => {
6269
6333
  if (PlaitDrawElement.isGeometry(value) ||
6270
- PlaitDrawElement.isLine(value) ||
6334
+ PlaitDrawElement.isArrowLine(value) ||
6271
6335
  PlaitDrawElement.isImage(value) ||
6272
6336
  PlaitDrawElement.isTable(value) ||
6273
6337
  PlaitDrawElement.isSwimlane(value)) {
@@ -6278,7 +6342,10 @@ const PlaitDrawElement = {
6278
6342
  }
6279
6343
  },
6280
6344
  isShapeElement: (value) => {
6281
- return PlaitDrawElement.isImage(value) || PlaitDrawElement.isGeometry(value) || PlaitDrawElement.isTable(value) || PlaitDrawElement.isSwimlane(value);
6345
+ return (PlaitDrawElement.isImage(value) ||
6346
+ PlaitDrawElement.isGeometry(value) ||
6347
+ PlaitDrawElement.isTable(value) ||
6348
+ PlaitDrawElement.isSwimlane(value));
6282
6349
  },
6283
6350
  isBasicShape: (value) => {
6284
6351
  return Object.keys(BasicShapes).includes(value.shape);
@@ -6306,7 +6373,7 @@ const PlaitDrawElement = {
6306
6373
  },
6307
6374
  isElementByTable: (value) => {
6308
6375
  return PlaitDrawElement.isTable(value) || PlaitDrawElement.isSwimlane(value) || PlaitDrawElement.isGeometryByTable(value);
6309
- },
6376
+ }
6310
6377
  };
6311
6378
 
6312
6379
  class GeometryShapeGenerator extends Generator {
@@ -6332,7 +6399,7 @@ class GeometryShapeGenerator extends Generator {
6332
6399
  }
6333
6400
  }
6334
6401
 
6335
- class LineAutoCompleteGenerator extends Generator {
6402
+ class ArrowLineAutoCompleteGenerator extends Generator {
6336
6403
  static { this.key = 'line-auto-complete-generator'; }
6337
6404
  constructor(board) {
6338
6405
  super(board);
@@ -6419,12 +6486,12 @@ class GeometryComponent extends CommonElementFlavour {
6419
6486
  return canResize(this.board, this.element);
6420
6487
  }
6421
6488
  });
6422
- this.lineAutoCompleteGenerator = new LineAutoCompleteGenerator(this.board);
6489
+ this.lineAutoCompleteGenerator = new ArrowLineAutoCompleteGenerator(this.board);
6423
6490
  this.shapeGenerator = new GeometryShapeGenerator(this.board);
6424
6491
  if (isGeometryIncludeText(this.element)) {
6425
6492
  this.initializeTextManage();
6426
6493
  }
6427
- this.getRef().addGenerator(LineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
6494
+ this.getRef().addGenerator(ArrowLineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
6428
6495
  this.getRef().addGenerator(ActiveGenerator.key, this.activeGenerator);
6429
6496
  }
6430
6497
  initialize() {
@@ -6515,7 +6582,7 @@ class GeometryComponent extends CommonElementFlavour {
6515
6582
  }
6516
6583
  }
6517
6584
 
6518
- class LineActiveGenerator extends Generator {
6585
+ class ArrowLineActiveGenerator extends Generator {
6519
6586
  constructor() {
6520
6587
  super(...arguments);
6521
6588
  this.onlySelectedCurrentLine = false;
@@ -6535,10 +6602,10 @@ class LineActiveGenerator extends Generator {
6535
6602
  if (this.onlySelectedCurrentLine) {
6536
6603
  activeG.classList.add('active');
6537
6604
  activeG.classList.add('line-handle');
6538
- const points = PlaitLine.getPoints(this.board, element);
6605
+ const points = PlaitArrowLine.getPoints(this.board, element);
6539
6606
  let updatePoints = [...points];
6540
6607
  let elbowNextRenderPoints = [];
6541
- if (element.shape === LineShape.elbow) {
6608
+ if (element.shape === ArrowLineShape.elbow) {
6542
6609
  updatePoints = points.slice(0, 1).concat(points.slice(-1));
6543
6610
  elbowNextRenderPoints = getNextRenderPoints(this.board, element, data.linePoints);
6544
6611
  }
@@ -6550,7 +6617,7 @@ class LineActiveGenerator extends Generator {
6550
6617
  if (!PlaitBoard.hasBeenTextEditing(this.board)) {
6551
6618
  for (let i = 0; i < middlePoints.length; i++) {
6552
6619
  const point = middlePoints[i];
6553
- if (element.shape === LineShape.elbow && elbowNextRenderPoints.length) {
6620
+ if (element.shape === ArrowLineShape.elbow && elbowNextRenderPoints.length) {
6554
6621
  const handleIndex = getHitPointIndex(middlePoints, point);
6555
6622
  const isUpdateHandleIndex = isUpdatedHandleIndex(this.board, element, [...points], elbowNextRenderPoints, handleIndex);
6556
6623
  if (isUpdateHandleIndex) {
@@ -6590,20 +6657,20 @@ class LineActiveGenerator extends Generator {
6590
6657
 
6591
6658
  const debugKey = 'debug:plait:line-turning';
6592
6659
  const debugGenerator = createDebugGenerator(debugKey);
6593
- class LineComponent extends CommonElementFlavour {
6660
+ class ArrowLineComponent extends CommonElementFlavour {
6594
6661
  constructor() {
6595
6662
  super();
6596
6663
  this.boundedElements = {};
6597
6664
  }
6598
6665
  initializeGenerator() {
6599
- this.shapeGenerator = new LineShapeGenerator(this.board);
6600
- this.activeGenerator = new LineActiveGenerator(this.board);
6666
+ this.shapeGenerator = new ArrowLineShapeGenerator(this.board);
6667
+ this.activeGenerator = new ArrowLineActiveGenerator(this.board);
6601
6668
  this.initializeTextManagesByElement();
6602
6669
  }
6603
6670
  initialize() {
6604
6671
  this.initializeGenerator();
6605
6672
  this.shapeGenerator.processDrawing(this.element, this.getElementG());
6606
- const linePoints = getLinePoints(this.board, this.element);
6673
+ const linePoints = getArrowLinePoints(this.board, this.element);
6607
6674
  this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), {
6608
6675
  selected: this.selected,
6609
6676
  linePoints
@@ -6635,7 +6702,7 @@ class LineComponent extends CommonElementFlavour {
6635
6702
  const isBoundedElementsChanged = boundedElements.source !== this.boundedElements.source || boundedElements.target !== this.boundedElements.target;
6636
6703
  this.boundedElements = boundedElements;
6637
6704
  const isChangeTheme = this.board.operations.find(op => op.type === 'set_theme');
6638
- const linePoints = getLinePoints(this.board, this.element);
6705
+ const linePoints = getArrowLinePoints(this.board, this.element);
6639
6706
  if (value.element !== previous.element || isChangeTheme) {
6640
6707
  this.shapeGenerator.processDrawing(this.element, this.getElementG());
6641
6708
  this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), {
@@ -6685,10 +6752,12 @@ class LineComponent extends CommonElementFlavour {
6685
6752
  createTextManage(text, index) {
6686
6753
  return new TextManage(this.board, {
6687
6754
  getRectangle: () => {
6688
- return getLineTextRectangle(this.board, this.element, index);
6755
+ return getArrowLineTextRectangle(this.board, this.element, index);
6689
6756
  },
6690
6757
  onChange: (textManageChangeData) => {
6691
- const texts = [...this.element.texts];
6758
+ const path = PlaitBoard.findPath(this.board, this.element);
6759
+ const node = PlaitNode.get(this.board, path);
6760
+ const texts = [...node.texts];
6692
6761
  const newWidth = textManageChangeData.width < MIN_TEXT_WIDTH ? MIN_TEXT_WIDTH : textManageChangeData.width;
6693
6762
  texts.splice(index, 1, {
6694
6763
  text: textManageChangeData.newText ? textManageChangeData.newText : this.element.texts[index].text,
@@ -6696,7 +6765,7 @@ class LineComponent extends CommonElementFlavour {
6696
6765
  width: newWidth,
6697
6766
  height: textManageChangeData.height
6698
6767
  });
6699
- DrawTransforms.setLineTexts(this.board, this.element, texts);
6768
+ DrawTransforms.setArrowLineTexts(this.board, this.element, texts);
6700
6769
  textManageChangeData.operations && memorizeLatestText(this.element, textManageChangeData.operations);
6701
6770
  },
6702
6771
  getMaxWidth: () => GeometryThreshold.defaultTextMaxWidth,
@@ -6976,7 +7045,7 @@ const buildClipboardData = (board, elements, startPoint) => {
6976
7045
  const points = element.points.map(point => [point[0] - startPoint[0], point[1] - startPoint[1]]);
6977
7046
  return { ...element, points };
6978
7047
  }
6979
- if (PlaitDrawElement.isLine(element)) {
7048
+ if (PlaitDrawElement.isArrowLine(element)) {
6980
7049
  let source = { ...element.source };
6981
7050
  let target = { ...element.target };
6982
7051
  let points = [...element.points];
@@ -7001,12 +7070,12 @@ const buildClipboardData = (board, elements, startPoint) => {
7001
7070
  });
7002
7071
  };
7003
7072
  const insertClipboardData = (board, elements, startPoint) => {
7004
- const lines = elements.filter(value => PlaitDrawElement.isLine(value));
7073
+ const lines = elements.filter(value => PlaitDrawElement.isArrowLine(value));
7005
7074
  const geometries = elements.filter(value => (PlaitDrawElement.isGeometry(value) && !PlaitDrawElement.isGeometryByTable(value)) || PlaitDrawElement.isImage(value));
7006
7075
  const tables = elements.filter(value => PlaitDrawElement.isElementByTable(value));
7007
7076
  geometries.forEach(element => {
7008
7077
  const newId = idCreator();
7009
- updateBoundLinesId(element, lines, newId);
7078
+ updateBoundArrowLinesId(element, lines, newId);
7010
7079
  element.id = newId;
7011
7080
  element.points = element.points.map(point => [startPoint[0] + point[0], startPoint[1] + point[1]]);
7012
7081
  Transforms.insertNode(board, element, [board.children.length]);
@@ -7022,7 +7091,7 @@ const insertClipboardData = (board, elements, startPoint) => {
7022
7091
  const insertClipboardTableData = (board, elements, startPoint, lines) => {
7023
7092
  elements.forEach(element => {
7024
7093
  const newId = idCreator();
7025
- updateBoundLinesId(element, lines, newId);
7094
+ updateBoundArrowLinesId(element, lines, newId);
7026
7095
  element.id = newId;
7027
7096
  updateRowOrColumnIds(element, 'row');
7028
7097
  updateRowOrColumnIds(element, 'column');
@@ -7031,14 +7100,14 @@ const insertClipboardTableData = (board, elements, startPoint, lines) => {
7031
7100
  Transforms.insertNode(board, element, [board.children.length]);
7032
7101
  });
7033
7102
  };
7034
- const updateBoundLinesId = (element, lines, newId) => {
7103
+ const updateBoundArrowLinesId = (element, lines, newId) => {
7035
7104
  const sourceLines = [];
7036
7105
  const targetLines = [];
7037
7106
  lines.forEach(line => {
7038
- if (PlaitLine.isBoundElementOfSource(line, element)) {
7107
+ if (PlaitArrowLine.isBoundElementOfSource(line, element)) {
7039
7108
  sourceLines.push(line);
7040
7109
  }
7041
- if (PlaitLine.isBoundElementOfTarget(line, element)) {
7110
+ if (PlaitArrowLine.isBoundElementOfTarget(line, element)) {
7042
7111
  targetLines.push(line);
7043
7112
  }
7044
7113
  });
@@ -7054,15 +7123,15 @@ const withDrawFragment = (baseBoard) => {
7054
7123
  const drawElements = getSelectedDrawElements(board);
7055
7124
  if (drawElements.length) {
7056
7125
  const geometryElements = drawElements.filter(value => PlaitDrawElement.isGeometry(value));
7057
- const lineElements = drawElements.filter(value => PlaitDrawElement.isLine(value));
7126
+ const lineElements = drawElements.filter(value => PlaitDrawElement.isArrowLine(value));
7058
7127
  const imageElements = drawElements.filter(value => PlaitDrawElement.isImage(value));
7059
7128
  const tableElements = drawElements.filter(value => PlaitDrawElement.isTable(value));
7060
7129
  const swimlaneElements = drawElements.filter(value => PlaitDrawElement.isSwimlane(value));
7061
7130
  const boundLineElements = [
7062
- ...getBoundedLineElements(board, geometryElements),
7063
- ...getBoundedLineElements(board, imageElements),
7064
- ...getBoundedLineElements(board, tableElements),
7065
- ...getBoundedLineElements(board, swimlaneElements)
7131
+ ...getBoundedArrowLineElements(board, geometryElements),
7132
+ ...getBoundedArrowLineElements(board, imageElements),
7133
+ ...getBoundedArrowLineElements(board, tableElements),
7134
+ ...getBoundedArrowLineElements(board, swimlaneElements)
7066
7135
  ].filter(line => !lineElements.includes(line));
7067
7136
  data.push(...[
7068
7137
  ...geometryElements,
@@ -7081,8 +7150,8 @@ const withDrawFragment = (baseBoard) => {
7081
7150
  if (targetDrawElements.length) {
7082
7151
  if (operationType === WritableClipboardOperationType.cut) {
7083
7152
  const geometryElements = targetDrawElements.filter(value => PlaitDrawElement.isGeometry(value));
7084
- const lineElements = targetDrawElements.filter(value => PlaitDrawElement.isLine(value));
7085
- boundLineElements = getBoundedLineElements(board, geometryElements).filter(line => !lineElements.includes(line));
7153
+ const lineElements = targetDrawElements.filter(value => PlaitDrawElement.isArrowLine(value));
7154
+ boundLineElements = getBoundedArrowLineElements(board, geometryElements).filter(line => !lineElements.includes(line));
7086
7155
  }
7087
7156
  const selectedElements = [...targetDrawElements, ...boundLineElements];
7088
7157
  const elements = buildClipboardData(board, selectedElements, rectangle ? [rectangle.x, rectangle.y] : [0, 0]);
@@ -7134,19 +7203,19 @@ const withDrawFragment = (baseBoard) => {
7134
7203
  };
7135
7204
  return board;
7136
7205
  };
7137
- const getBoundedLineElements = (board, plaitShapes) => {
7138
- const lines = getLines(board);
7139
- return lines.filter(line => plaitShapes.find(shape => PlaitLine.isBoundElementOfSource(line, shape) || PlaitLine.isBoundElementOfTarget(line, shape)));
7206
+ const getBoundedArrowLineElements = (board, plaitShapes) => {
7207
+ const lines = getArrowLines(board);
7208
+ return lines.filter(line => plaitShapes.find(shape => PlaitArrowLine.isBoundElementOfSource(line, shape) || PlaitArrowLine.isBoundElementOfTarget(line, shape)));
7140
7209
  };
7141
7210
 
7142
- const withLineCreateByDraw = (board) => {
7211
+ const withArrowLineCreateByDraw = (board) => {
7143
7212
  const { pointerDown, pointerMove, globalPointerUp } = board;
7144
7213
  let start = null;
7145
7214
  let sourceElement;
7146
7215
  let lineShapeG = null;
7147
7216
  let temporaryElement = null;
7148
7217
  board.pointerDown = (event) => {
7149
- const linePointers = getLinePointers();
7218
+ const linePointers = getArrowLinePointers();
7150
7219
  const isLinePointer = PlaitBoard.isInPointer(board, linePointers);
7151
7220
  if (!PlaitBoard.isReadonly(board) && isLinePointer && isDrawingMode(board)) {
7152
7221
  const point = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
@@ -7165,7 +7234,7 @@ const withLineCreateByDraw = (board) => {
7165
7234
  let movingPoint = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
7166
7235
  if (start) {
7167
7236
  const lineShape = PlaitBoard.getPointer(board);
7168
- temporaryElement = handleLineCreating(board, lineShape, start, movingPoint, sourceElement, lineShapeG);
7237
+ temporaryElement = handleArrowLineCreating(board, lineShape, start, movingPoint, sourceElement, lineShapeG);
7169
7238
  }
7170
7239
  pointerMove(event);
7171
7240
  };
@@ -7248,7 +7317,7 @@ const withGeometryResize = (board) => {
7248
7317
  return board;
7249
7318
  };
7250
7319
 
7251
- const withLineResize = (board) => {
7320
+ const withArrowLineResize = (board) => {
7252
7321
  let elbowLineIndex;
7253
7322
  let elbowLineDeleteCount;
7254
7323
  let elbowSourcePoint;
@@ -7260,11 +7329,11 @@ const withLineResize = (board) => {
7260
7329
  return true;
7261
7330
  },
7262
7331
  hitTest: (point) => {
7263
- const selectedLineElements = getSelectedLineElements(board);
7332
+ const selectedLineElements = getSelectedArrowLineElements(board);
7264
7333
  if (selectedLineElements.length > 0) {
7265
7334
  let result = null;
7266
7335
  selectedLineElements.forEach(value => {
7267
- const handleRef = getHitLineResizeHandleRef(board, value, point);
7336
+ const handleRef = getHitArrowLineResizeHandleRef(board, value, point);
7268
7337
  if (handleRef) {
7269
7338
  result = {
7270
7339
  element: value,
@@ -7278,9 +7347,9 @@ const withLineResize = (board) => {
7278
7347
  return null;
7279
7348
  },
7280
7349
  beforeResize: (resizeRef) => {
7281
- if (resizeRef.element.shape === LineShape.elbow &&
7282
- resizeRef.handle !== LineResizeHandle.source &&
7283
- resizeRef.handle !== LineResizeHandle.target) {
7350
+ if (resizeRef.element.shape === ArrowLineShape.elbow &&
7351
+ resizeRef.handle !== ArrowLineResizeHandle.source &&
7352
+ resizeRef.handle !== ArrowLineResizeHandle.target) {
7284
7353
  const params = getElbowLineRouteOptions(board, resizeRef.element);
7285
7354
  if (isUseDefaultOrthogonalRoute(resizeRef.element, params)) {
7286
7355
  return;
@@ -7302,8 +7371,8 @@ const withLineResize = (board) => {
7302
7371
  let target = { ...resizeRef.element.target };
7303
7372
  let handleIndex = resizeRef.handleIndex;
7304
7373
  const hitElement = getSnappingShape(board, resizeState.endPoint);
7305
- if (resizeRef.handle === LineResizeHandle.source || resizeRef.handle === LineResizeHandle.target) {
7306
- const object = resizeRef.handle === LineResizeHandle.source ? source : target;
7374
+ if (resizeRef.handle === ArrowLineResizeHandle.source || resizeRef.handle === ArrowLineResizeHandle.target) {
7375
+ const object = resizeRef.handle === ArrowLineResizeHandle.source ? source : target;
7307
7376
  points[handleIndex] = resizeState.endPoint;
7308
7377
  if (hitElement) {
7309
7378
  object.connection = getHitConnection(board, resizeState.endPoint, hitElement);
@@ -7315,7 +7384,7 @@ const withLineResize = (board) => {
7315
7384
  }
7316
7385
  }
7317
7386
  else {
7318
- if (resizeRef.element.shape === LineShape.elbow) {
7387
+ if (resizeRef.element.shape === ArrowLineShape.elbow) {
7319
7388
  if (elbowNextRenderPoints && elbowSourcePoint && elbowTargetPoint) {
7320
7389
  const resizedPreviousAndNextPoint = getResizedPreviousAndNextPoint(elbowNextRenderPoints, elbowSourcePoint, elbowTargetPoint, handleIndex);
7321
7390
  const startKeyPoint = elbowNextRenderPoints[handleIndex];
@@ -7334,7 +7403,7 @@ const withLineResize = (board) => {
7334
7403
  }
7335
7404
  }
7336
7405
  else {
7337
- if (resizeRef.handle === LineResizeHandle.addHandle) {
7406
+ if (resizeRef.handle === ArrowLineResizeHandle.addHandle) {
7338
7407
  points.splice(handleIndex + 1, 0, resizeState.endPoint);
7339
7408
  }
7340
7409
  else {
@@ -7343,13 +7412,13 @@ const withLineResize = (board) => {
7343
7412
  }
7344
7413
  }
7345
7414
  if (!hitElement) {
7346
- handleIndex = resizeRef.handle === LineResizeHandle.addHandle ? handleIndex + 1 : handleIndex;
7347
- const drawPoints = getLinePoints(board, resizeRef.element);
7415
+ handleIndex = resizeRef.handle === ArrowLineResizeHandle.addHandle ? handleIndex + 1 : handleIndex;
7416
+ const drawPoints = getArrowLinePoints(board, resizeRef.element);
7348
7417
  const newPoints = [...points];
7349
7418
  newPoints[0] = drawPoints[0];
7350
7419
  newPoints[newPoints.length - 1] = drawPoints[drawPoints.length - 1];
7351
- if (resizeRef.element.shape !== LineShape.elbow ||
7352
- (resizeRef.element.shape === LineShape.elbow && newPoints.length === 2)) {
7420
+ if (resizeRef.element.shape !== ArrowLineShape.elbow ||
7421
+ (resizeRef.element.shape === ArrowLineShape.elbow && newPoints.length === 2)) {
7353
7422
  newPoints.forEach((point, index) => {
7354
7423
  if (index === handleIndex)
7355
7424
  return;
@@ -7359,10 +7428,10 @@ const withLineResize = (board) => {
7359
7428
  });
7360
7429
  }
7361
7430
  }
7362
- DrawTransforms.resizeLine(board, { points, source, target }, resizeRef.path);
7431
+ DrawTransforms.resizeArrowLine(board, { points, source, target }, resizeRef.path);
7363
7432
  },
7364
7433
  afterResize: (resizeRef) => {
7365
- if (resizeRef.element.shape === LineShape.elbow) {
7434
+ if (resizeRef.element.shape === ArrowLineShape.elbow) {
7366
7435
  const element = PlaitNode.get(board, resizeRef.path);
7367
7436
  let points = element && [...element.points];
7368
7437
  if (points.length > 2 && elbowNextRenderPoints && elbowSourcePoint && elbowTargetPoint) {
@@ -7381,7 +7450,7 @@ const withLineResize = (board) => {
7381
7450
  points = [];
7382
7451
  }
7383
7452
  points = [elbowSourcePoint, ...points, elbowTargetPoint];
7384
- DrawTransforms.resizeLine(board, { points }, resizeRef.path);
7453
+ DrawTransforms.resizeArrowLine(board, { points }, resizeRef.path);
7385
7454
  }
7386
7455
  }
7387
7456
  elbowLineIndex = null;
@@ -7395,7 +7464,7 @@ const withLineResize = (board) => {
7395
7464
  return board;
7396
7465
  };
7397
7466
 
7398
- const withLineBoundReaction = (board) => {
7467
+ const withArrowLineBoundReaction = (board) => {
7399
7468
  const { pointerMove, pointerUp } = board;
7400
7469
  let boundShapeG = null;
7401
7470
  board.pointerMove = (event) => {
@@ -7404,13 +7473,13 @@ const withLineBoundReaction = (board) => {
7404
7473
  pointerMove(event);
7405
7474
  return;
7406
7475
  }
7407
- const linePointers = Object.keys(LineShape);
7476
+ const linePointers = Object.keys(ArrowLineShape);
7408
7477
  const isLinePointer = PlaitBoard.isInPointer(board, linePointers);
7409
7478
  const movingPoint = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
7410
7479
  const isLineResizing = isResizingByCondition(board, resizeRef => {
7411
7480
  const { element, handle } = resizeRef;
7412
- const isSourceOrTarget = handle === LineResizeHandle.target || handle === LineResizeHandle.source;
7413
- return PlaitDrawElement.isLine(element) && isSourceOrTarget;
7481
+ const isSourceOrTarget = handle === ArrowLineResizeHandle.target || handle === ArrowLineResizeHandle.source;
7482
+ return PlaitDrawElement.isArrowLine(element) && isSourceOrTarget;
7414
7483
  });
7415
7484
  if (isLinePointer || isLineResizing) {
7416
7485
  const hitElement = getHitShape(board, movingPoint);
@@ -7443,33 +7512,34 @@ const withLineBoundReaction = (board) => {
7443
7512
  return board;
7444
7513
  };
7445
7514
 
7446
- const withLineText = (board) => {
7515
+ const withArrowLineText = (board) => {
7447
7516
  const { dblClick } = board;
7448
7517
  board.dblClick = (event) => {
7449
7518
  if (!PlaitBoard.isReadonly(board)) {
7450
7519
  const clickPoint = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
7451
7520
  const hitTarget = getHitElementByPoint(board, clickPoint, (element) => {
7452
- return PlaitDrawElement.isLine(element);
7521
+ return PlaitDrawElement.isArrowLine(element);
7453
7522
  });
7454
7523
  const hitTargetPath = hitTarget && PlaitBoard.findPath(board, hitTarget);
7455
7524
  if (hitTarget) {
7456
- const points = getLinePoints(board, hitTarget);
7525
+ const points = getArrowLinePoints(board, hitTarget);
7457
7526
  const point = getNearestPointBetweenPointAndSegments(clickPoint, points);
7458
7527
  const texts = hitTarget.texts?.length ? [...hitTarget.texts] : [];
7459
- const textIndex = getHitLineTextIndex(board, hitTarget, clickPoint);
7460
- const isHitText = isHitLineText(board, hitTarget, clickPoint);
7528
+ const textIndex = getHitArrowLineTextIndex(board, hitTarget, clickPoint);
7529
+ const isHitText = isHitArrowLineText(board, hitTarget, clickPoint);
7461
7530
  if (isHitText) {
7462
7531
  editHandle(board, hitTarget, textIndex);
7463
7532
  }
7464
7533
  else {
7465
7534
  const ratio = getRatioByPoint(points, point);
7535
+ const textMemory = getMemorizedLatest('line')?.text || {};
7466
7536
  texts.push({
7467
- text: buildText(LINE_TEXT),
7537
+ text: buildText(LINE_TEXT, undefined, textMemory),
7468
7538
  position: ratio,
7469
7539
  width: 28,
7470
7540
  height: 20
7471
7541
  });
7472
- DrawTransforms.setLineTexts(board, hitTarget, texts);
7542
+ DrawTransforms.setArrowLineTexts(board, hitTarget, texts);
7473
7543
  setTimeout(() => {
7474
7544
  if (hitTargetPath) {
7475
7545
  const newHitTarget = PlaitNode.get(board, hitTargetPath);
@@ -7491,7 +7561,7 @@ function editHandle(board, element, manageIndex, isFirstEdit = false) {
7491
7561
  const text = Node.string(textManage.getText());
7492
7562
  const shouldRemove = !text || (isFirstEdit && text === LINE_TEXT);
7493
7563
  if (shouldRemove) {
7494
- DrawTransforms.removeLineText(board, element, manageIndex);
7564
+ DrawTransforms.removeArrowLineText(board, element, manageIndex);
7495
7565
  }
7496
7566
  });
7497
7567
  }
@@ -7518,8 +7588,8 @@ class ImageComponent extends CommonElementFlavour {
7518
7588
  };
7519
7589
  }
7520
7590
  });
7521
- this.lineAutoCompleteGenerator = new LineAutoCompleteGenerator(this.board);
7522
- this.getRef().addGenerator(LineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
7591
+ this.lineAutoCompleteGenerator = new ArrowLineAutoCompleteGenerator(this.board);
7592
+ this.getRef().addGenerator(ArrowLineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
7523
7593
  }
7524
7594
  initialize() {
7525
7595
  super.initialize();
@@ -7556,7 +7626,7 @@ class ImageComponent extends CommonElementFlavour {
7556
7626
  }
7557
7627
  }
7558
7628
 
7559
- const withLineAutoCompleteReaction = (board) => {
7629
+ const withArrowLineAutoCompleteReaction = (board) => {
7560
7630
  const { pointerMove } = board;
7561
7631
  let reactionG = null;
7562
7632
  board.pointerMove = (event) => {
@@ -7570,7 +7640,7 @@ const withLineAutoCompleteReaction = (board) => {
7570
7640
  const hitIndex = getHitIndexOfAutoCompletePoint(rotateAntiPointsByElement(movingPoint, targetElement) || movingPoint, points);
7571
7641
  const hitPoint = points[hitIndex];
7572
7642
  const ref = PlaitElement.getElementRef(targetElement);
7573
- const lineAutoCompleteGenerator = ref.getGenerator(LineAutoCompleteGenerator.key);
7643
+ const lineAutoCompleteGenerator = ref.getGenerator(ArrowLineAutoCompleteGenerator.key);
7574
7644
  lineAutoCompleteGenerator.recoverAutoCompleteG();
7575
7645
  if (hitPoint) {
7576
7646
  lineAutoCompleteGenerator?.removeAutoCompleteG(hitIndex);
@@ -7591,8 +7661,8 @@ const withLineAutoCompleteReaction = (board) => {
7591
7661
  return board;
7592
7662
  };
7593
7663
 
7594
- const WithLineAutoCompletePluginKey = 'plait-line-auto-complete-plugin-key';
7595
- const withLineAutoComplete = (board) => {
7664
+ const WithArrowLineAutoCompletePluginKey = 'plait-arrow-line-auto-complete-plugin-key';
7665
+ const withArrowLineAutoComplete = (board) => {
7596
7666
  const { pointerDown, pointerMove, globalPointerUp } = board;
7597
7667
  let autoCompletePoint = null;
7598
7668
  let lineShapeG = null;
@@ -7610,7 +7680,7 @@ const withLineAutoComplete = (board) => {
7610
7680
  temporaryDisableSelection(board);
7611
7681
  autoCompletePoint = hitPoint;
7612
7682
  sourceElement = targetElement;
7613
- BoardTransforms.updatePointerType(board, LineShape.elbow);
7683
+ BoardTransforms.updatePointerType(board, ArrowLineShape.elbow);
7614
7684
  }
7615
7685
  }
7616
7686
  pointerDown(event);
@@ -7632,7 +7702,7 @@ const withLineAutoComplete = (board) => {
7632
7702
  }
7633
7703
  // source point must be click point
7634
7704
  const rotatedSourcePoint = rotatePointsByElement(sourcePoint, sourceElement) || sourcePoint;
7635
- temporaryElement = handleLineCreating(board, LineShape.elbow, rotatedSourcePoint, movingPoint, sourceElement, lineShapeG);
7705
+ temporaryElement = handleArrowLineCreating(board, ArrowLineShape.elbow, rotatedSourcePoint, movingPoint, sourceElement, lineShapeG);
7636
7706
  }
7637
7707
  }
7638
7708
  pointerMove(event);
@@ -7642,8 +7712,7 @@ const withLineAutoComplete = (board) => {
7642
7712
  Transforms.insertNode(board, temporaryElement, [board.children.length]);
7643
7713
  clearSelectedElement(board);
7644
7714
  addSelectedElement(board, temporaryElement);
7645
- const afterComplete = board.getPluginOptions(WithLineAutoCompletePluginKey)
7646
- ?.afterComplete;
7715
+ const afterComplete = board.getPluginOptions(WithArrowLineAutoCompletePluginKey)?.afterComplete;
7647
7716
  afterComplete && afterComplete(temporaryElement);
7648
7717
  }
7649
7718
  if (autoCompletePoint) {
@@ -7659,7 +7728,7 @@ const withLineAutoComplete = (board) => {
7659
7728
  return board;
7660
7729
  };
7661
7730
 
7662
- const withLineTextMove = (board) => {
7731
+ const withArrowLineTextMove = (board) => {
7663
7732
  let textIndex = 0;
7664
7733
  const movableBuffer = 100;
7665
7734
  const options = {
@@ -7670,10 +7739,10 @@ const withLineTextMove = (board) => {
7670
7739
  hitTest: (point) => {
7671
7740
  let result = null;
7672
7741
  const line = getHitElementByPoint(board, point, (element) => {
7673
- return PlaitDrawElement.isLine(element);
7742
+ return PlaitDrawElement.isArrowLine(element);
7674
7743
  });
7675
7744
  if (line) {
7676
- const index = getHitLineTextIndex(board, line, point);
7745
+ const index = getHitArrowLineTextIndex(board, line, point);
7677
7746
  const textManages = getTextManages(line);
7678
7747
  const textManage = textManages[index];
7679
7748
  if (index !== -1 && !textManage.isEditing) {
@@ -7687,7 +7756,7 @@ const withLineTextMove = (board) => {
7687
7756
  const element = resizeRef.element;
7688
7757
  if (element) {
7689
7758
  const movingPoint = resizeState.endPoint;
7690
- const points = getLinePoints(board, element);
7759
+ const points = getArrowLinePoints(board, element);
7691
7760
  const distance = distanceBetweenPointAndSegments(points, movingPoint);
7692
7761
  if (distance <= movableBuffer) {
7693
7762
  const point = getNearestPointBetweenPointAndSegments(movingPoint, points, false);
@@ -7697,7 +7766,7 @@ const withLineTextMove = (board) => {
7697
7766
  ...texts[textIndex],
7698
7767
  position
7699
7768
  };
7700
- DrawTransforms.setLineTexts(board, element, texts);
7769
+ DrawTransforms.setArrowLineTexts(board, element, texts);
7701
7770
  }
7702
7771
  }
7703
7772
  }
@@ -7857,8 +7926,8 @@ class TableComponent extends CommonElementFlavour {
7857
7926
  });
7858
7927
  this.tableGenerator = new TableGenerator(this.board);
7859
7928
  this.initializeTextManage();
7860
- this.lineAutoCompleteGenerator = new LineAutoCompleteGenerator(this.board);
7861
- this.getRef().addGenerator(LineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
7929
+ this.lineAutoCompleteGenerator = new ArrowLineAutoCompleteGenerator(this.board);
7930
+ this.getRef().addGenerator(ArrowLineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
7862
7931
  }
7863
7932
  initialize() {
7864
7933
  super.initialize();
@@ -7904,9 +7973,9 @@ class TableComponent extends CommonElementFlavour {
7904
7973
  this.textGenerator = new TextGenerator(this.board, this.element, texts, {
7905
7974
  onChange: (value, data, text) => {
7906
7975
  const height = data.height / this.board.viewport.zoom;
7907
- const width = data.width / this.board.viewport.zoom;
7976
+ const path = PlaitBoard.findPath(this.board, value);
7908
7977
  if (data.newText) {
7909
- DrawTransforms.setTableText(this.board, value, text.key, data.newText, width, height);
7978
+ DrawTransforms.setTableText(this.board, path, text.key, data.newText, height);
7910
7979
  }
7911
7980
  data.operations && memorizeLatestText(value, data.operations);
7912
7981
  },
@@ -8097,7 +8166,7 @@ function withTableResize(board) {
8097
8166
 
8098
8167
  const withTable = (board) => {
8099
8168
  const tableBoard = board;
8100
- const { drawElement, getRectangle, isRectangleHit, isHit, isMovable, dblClick, keyDown } = tableBoard;
8169
+ const { drawElement, getRectangle, isRectangleHit, isHit, isMovable, dblClick, keyDown, pointerUp } = tableBoard;
8101
8170
  tableBoard.drawElement = (context) => {
8102
8171
  if (PlaitDrawElement.isElementByTable(context.element)) {
8103
8172
  return TableComponent;
@@ -8161,6 +8230,23 @@ const withTable = (board) => {
8161
8230
  }
8162
8231
  dblClick(event);
8163
8232
  };
8233
+ tableBoard.pointerUp = (event) => {
8234
+ const isSetSelectionPointer = PlaitBoard.isPointer(tableBoard, PlaitPointerType.selection) || PlaitBoard.isPointer(tableBoard, PlaitPointerType.hand);
8235
+ const isSkip = !isMainPointer(event) || isDragging(tableBoard) || !isSetSelectionPointer;
8236
+ if (isSkip) {
8237
+ pointerUp(event);
8238
+ return;
8239
+ }
8240
+ if (isSingleSelectTable(tableBoard)) {
8241
+ const point = toViewBoxPoint(tableBoard, toHostPoint(tableBoard, event.x, event.y));
8242
+ const element = getSelectedTableElements(tableBoard)[0];
8243
+ const hitCell = getHitCell(tableBoard, element, point);
8244
+ if (hitCell && hitCell.text && hitCell.textHeight) {
8245
+ setSelectedCells(element, [hitCell]);
8246
+ }
8247
+ }
8248
+ pointerUp(event);
8249
+ };
8164
8250
  tableBoard.buildTable = (element) => {
8165
8251
  return element;
8166
8252
  };
@@ -8305,28 +8391,11 @@ const withSwimlane = (board) => {
8305
8391
  }
8306
8392
  return buildTable(element);
8307
8393
  };
8308
- board.pointerUp = (event) => {
8309
- const isSetSelectionPointer = PlaitBoard.isPointer(board, PlaitPointerType.selection) || PlaitBoard.isPointer(board, PlaitPointerType.hand);
8310
- const isSkip = !isMainPointer(event) || isDragging(board) || !isSetSelectionPointer;
8311
- if (isSkip) {
8312
- pointerUp(event);
8313
- return;
8314
- }
8315
- if (isSingleSelectSwimlane(board)) {
8316
- const point = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
8317
- const element = getSelectedSwimlane(board);
8318
- const hitCell = getHitCell(board, element, point);
8319
- if (hitCell && hitCell.text && hitCell.textHeight) {
8320
- setSelectedCells(element, [hitCell]);
8321
- }
8322
- }
8323
- pointerUp(event);
8324
- };
8325
8394
  return withSwimlaneCreateByDrawing(withSwimlaneCreateByDrag(board));
8326
8395
  };
8327
8396
 
8328
8397
  const withDraw = (board) => {
8329
- const { drawElement, getRectangle, isRectangleHit, isHit, isInsidePoint, isMovable, isAlign, getRelatedFragment } = board;
8398
+ const { drawElement, getRectangle, isRectangleHit, isHit, isInsidePoint, isMovable, isAlign, getRelatedFragment, getHitElement } = board;
8330
8399
  board.drawElement = (context) => {
8331
8400
  if (PlaitDrawElement.isGeometry(context.element)) {
8332
8401
  if (PlaitDrawElement.isUML(context.element)) {
@@ -8334,8 +8403,8 @@ const withDraw = (board) => {
8334
8403
  }
8335
8404
  return GeometryComponent;
8336
8405
  }
8337
- else if (PlaitDrawElement.isLine(context.element)) {
8338
- return LineComponent;
8406
+ else if (PlaitDrawElement.isArrowLine(context.element)) {
8407
+ return ArrowLineComponent;
8339
8408
  }
8340
8409
  else if (PlaitDrawElement.isImage(context.element)) {
8341
8410
  return ImageComponent;
@@ -8346,10 +8415,10 @@ const withDraw = (board) => {
8346
8415
  if (PlaitDrawElement.isGeometry(element)) {
8347
8416
  return RectangleClient.getRectangleByPoints(element.points);
8348
8417
  }
8349
- if (PlaitDrawElement.isLine(element)) {
8350
- const points = getLinePoints(board, element);
8418
+ if (PlaitDrawElement.isArrowLine(element)) {
8419
+ const points = getArrowLinePoints(board, element);
8351
8420
  const lineTextRectangles = element.texts.map((text, index) => {
8352
- const rectangle = getLineTextRectangle(board, element, index);
8421
+ const rectangle = getArrowLineTextRectangle(board, element, index);
8353
8422
  return rectangle;
8354
8423
  });
8355
8424
  const linePointsRectangle = RectangleClient.getRectangleByPoints(points);
@@ -8374,6 +8443,13 @@ const withDraw = (board) => {
8374
8443
  }
8375
8444
  return isHit(element, point);
8376
8445
  };
8446
+ board.getHitElement = elements => {
8447
+ const isDrawElements = elements.every(item => PlaitDrawElement.isDrawElement(item));
8448
+ if (isDrawElements) {
8449
+ return getDrawHitElement(board, elements);
8450
+ }
8451
+ return getHitElement(elements);
8452
+ };
8377
8453
  board.isInsidePoint = (element, point) => {
8378
8454
  const result = isHitElementInside(board, element, point);
8379
8455
  if (result !== null) {
@@ -8388,7 +8464,7 @@ const withDraw = (board) => {
8388
8464
  if (PlaitDrawElement.isImage(element)) {
8389
8465
  return true;
8390
8466
  }
8391
- if (PlaitDrawElement.isLine(element)) {
8467
+ if (PlaitDrawElement.isArrowLine(element)) {
8392
8468
  const selectedElements = getSelectedElements(board);
8393
8469
  const isSelected = (boundId) => {
8394
8470
  return !!selectedElements.find(value => value.id === boundId);
@@ -8414,7 +8490,7 @@ const withDraw = (board) => {
8414
8490
  };
8415
8491
  board.getRelatedFragment = (elements, originData) => {
8416
8492
  const selectedElements = originData?.length ? originData : getSelectedElements(board);
8417
- const lineElements = board.children.filter(element => PlaitDrawElement.isLine(element));
8493
+ const lineElements = board.children.filter(element => PlaitDrawElement.isArrowLine(element));
8418
8494
  const activeLines = lineElements.filter(line => {
8419
8495
  const source = selectedElements.find(element => element.id === line.source.boundId);
8420
8496
  const target = selectedElements.find(element => element.id === line.target.boundId);
@@ -8423,12 +8499,12 @@ const withDraw = (board) => {
8423
8499
  });
8424
8500
  return getRelatedFragment([...elements, ...activeLines], originData);
8425
8501
  };
8426
- return withSwimlane(withTable(withDrawResize(withLineAutoCompleteReaction(withLineBoundReaction(withLineResize(withLineTextMove(withLineText(withGeometryResize(withDrawRotate(withLineCreateByDraw(withLineAutoComplete(withGeometryCreateByDrag(withGeometryCreateByDrawing(withDrawFragment(withDrawHotkey(board))))))))))))))));
8502
+ return withSwimlane(withTable(withDrawResize(withArrowLineAutoCompleteReaction(withArrowLineBoundReaction(withArrowLineResize(withArrowLineTextMove(withArrowLineText(withGeometryResize(withDrawRotate(withArrowLineCreateByDraw(withArrowLineAutoComplete(withGeometryCreateByDrag(withGeometryCreateByDrawing(withDrawFragment(withDrawHotkey(board))))))))))))))));
8427
8503
  };
8428
8504
 
8429
8505
  /**
8430
8506
  * Generated bundle index. Do not edit.
8431
8507
  */
8432
8508
 
8433
- export { BasicShapes, DEFAULT_IMAGE_WIDTH, DefaultActivationProperty, DefaultActorProperty, DefaultArrowProperty, DefaultAssemblyProperty, DefaultBasicShapeProperty, DefaultBasicShapePropertyMap, DefaultClassProperty, DefaultCloudProperty, DefaultCombinedFragmentProperty, DefaultComponentBoxProperty, DefaultConnectorProperty, DefaultContainerProperty, DefaultDataBaseProperty, DefaultDataProperty, DefaultDecisionProperty, DefaultDeletionProperty, DefaultDocumentProperty, DefaultDrawActiveStyle, DefaultDrawStyle, DefaultFlowchartProperty, DefaultFlowchartPropertyMap, DefaultInterfaceProperty, DefaultInternalStorageProperty, DefaultManualInputProperty, DefaultMergeProperty, DefaultMultiDocumentProperty, DefaultNoteProperty, DefaultObjectProperty, DefaultPackageProperty, DefaultPentagonArrowProperty, DefaultPortProperty, DefaultProvidedInterfaceProperty, DefaultRequiredInterfaceProperty, DefaultSwimlaneHorizontalProperty, DefaultSwimlaneHorizontalWithHeaderProperty, DefaultSwimlanePropertyMap, DefaultSwimlaneVerticalProperty, DefaultSwimlaneVerticalWithHeaderProperty, DefaultTextProperty, DefaultTwoWayArrowProperty, DefaultUMLPropertyMap, DrawThemeColors, DrawTransforms, FlowchartSymbols, GEOMETRY_WITHOUT_TEXT, GEOMETRY_WITH_MULTIPLE_TEXT, GeometryComponent, GeometryShapeGenerator, GeometryThreshold, KEY_TO_TEXT_MANAGE, LINE_HIT_GEOMETRY_BUFFER, LINE_SNAPPING_BUFFER, LINE_SNAPPING_CONNECTOR_BUFFER, LineActiveGenerator, LineAutoCompleteGenerator, LineComponent, LineHandleKey, LineMarkerType, LineShape, MIN_TEXT_WIDTH, MemorizeKey, MultipleTextGeometryCommonTextKeys, MultipleTextGeometryTextKeys, PlaitDrawElement, PlaitGeometry, PlaitLine, PlaitTableElement, Q2C, SELECTED_CELLS, SWIMLANE_HEADER_SIZE, ShapeDefaultSpace, SingleTextGenerator, StrokeStyle, SwimlaneDrawSymbols, SwimlaneSymbols, TableGenerator, TableSymbols, TextGenerator, UMLSymbols, WithLineAutoCompletePluginKey, adjustSwimlaneShape, alignElbowSegment, alignPoints, buildDefaultTextsByShape, buildSwimlaneTable, clearSelectedCells, createCell, createDefaultCells, createDefaultFlowchart, createDefaultGeometry, createDefaultRowsOrColumns, createDefaultSwimlane, createGeometryElement, createGeometryElementWithText, createGeometryElementWithoutText, createLineElement, createMultipleTextGeometryElement, createTextElement, createUMLClassOrInterfaceGeometryElement, debugGenerator$1 as debugGenerator, deleteTextManage, drawBoundReaction, drawGeometry, drawLine, drawLineArrow, drawShape, editCell, editText, getAutoCompletePoints, getBasicPointers, getCellWithPoints, getCellsRectangle, getCellsWithPoints, getCenterPointsOnPolygon$1 as getCenterPointsOnPolygon, getConnectionPoint, getCurvePoints, getDefaultBasicShapeProperty, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultSwimlanePoints, getDefaultTextPoints, getDefaultUMLProperty, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryAlign, getGeometryPointers, getHitCell, getHitConnection, getHitConnectorPoint, getHitIndexOfAutoCompletePoint, getHitMultipleGeometryText, getHitShape, getIndexAndDeleteCountByKeyPoint, getLineDashByElement, getLineHandleRefPair, getLineMemorizedLatest, getLinePointers, getLinePoints, getLineTextRectangle, getLines, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getMultipleTextGeometryTextKeys, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedCells, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedLineElements, getSelectedSwimlane, getSelectedTableElements, getSnapResizingRef, getSnapResizingRefOptions, getSnappingRef, getSnappingShape, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getSwimlaneCount, getSwimlanePointers, getTextKey, getTextManage, getTextManageByCell, getTextRectangle, getTextShapeProperty, getUMLPointers, getVectorByConnection, handleLineCreating, hasIllegalElbowPoint, insertElement, isCellIncludeText, isDrawElementIncludeText, isDrawElementsIncludeText, isGeometryIncludeText, isHitDrawElement, isHitEdgeOfShape, isHitElementInside, isHitElementText, isHitLine, isHitLineText, isHitPolyLine, isInsideOfShape, isMultipleTextGeometry, isMultipleTextShape, isRectangleHitDrawElement, isRectangleHitElementText, isSelfLoop, isSingleSelectElementByTable, isSingleSelectSwimlane, isSingleSelectTable, isSingleTextGeometry, isSingleTextShape, isSwimlaneWithHeader, isTextExceedingBounds, isUpdatedHandleIndex, isUseDefaultOrthogonalRoute, memorizeLatestShape, memorizeLatestText, rerenderGeometryActive, setSelectedCells, setTextManage, traverseDrawShapes, updateCellIds, updateCellIdsByRowOrColumn, updateColumns, updateRowOrColumnIds, updateRows, withDraw, withLineAutoComplete };
8509
+ export { ArrowLineActiveGenerator, ArrowLineAutoCompleteGenerator, ArrowLineComponent, ArrowLineHandleKey, ArrowLineMarkerType, ArrowLineShape, BasicShapes, DEFAULT_IMAGE_WIDTH, DefaultActivationProperty, DefaultActorProperty, DefaultArrowProperty, DefaultAssemblyProperty, DefaultBasicShapeProperty, DefaultBasicShapePropertyMap, DefaultClassProperty, DefaultCloudProperty, DefaultCombinedFragmentProperty, DefaultComponentBoxProperty, DefaultConnectorProperty, DefaultContainerProperty, DefaultDataBaseProperty, DefaultDataProperty, DefaultDecisionProperty, DefaultDeletionProperty, DefaultDocumentProperty, DefaultDrawActiveStyle, DefaultDrawStyle, DefaultFlowchartProperty, DefaultFlowchartPropertyMap, DefaultInterfaceProperty, DefaultInternalStorageProperty, DefaultManualInputProperty, DefaultMergeProperty, DefaultMultiDocumentProperty, DefaultNoteProperty, DefaultObjectProperty, DefaultPackageProperty, DefaultPentagonArrowProperty, DefaultPortProperty, DefaultProvidedInterfaceProperty, DefaultRequiredInterfaceProperty, DefaultSwimlaneHorizontalProperty, DefaultSwimlaneHorizontalWithHeaderProperty, DefaultSwimlanePropertyMap, DefaultSwimlaneVerticalProperty, DefaultSwimlaneVerticalWithHeaderProperty, DefaultTextProperty, DefaultTwoWayArrowProperty, DefaultUMLPropertyMap, DrawThemeColors, DrawTransforms, FlowchartSymbols, GEOMETRY_WITHOUT_TEXT, GEOMETRY_WITH_MULTIPLE_TEXT, GeometryComponent, GeometryShapeGenerator, GeometryThreshold, KEY_TO_TEXT_MANAGE, LINE_HIT_GEOMETRY_BUFFER, LINE_SNAPPING_BUFFER, LINE_SNAPPING_CONNECTOR_BUFFER, MIN_TEXT_WIDTH, MemorizeKey, MultipleTextGeometryCommonTextKeys, MultipleTextGeometryTextKeys, PlaitArrowLine, PlaitDrawElement, PlaitGeometry, PlaitTableElement, Q2C, SELECTED_CELLS, SWIMLANE_HEADER_SIZE, ShapeDefaultSpace, SingleTextGenerator, StrokeStyle, SwimlaneDrawSymbols, SwimlaneSymbols, TableGenerator, TableSymbols, TextGenerator, UMLSymbols, VectorLineShape, WithArrowLineAutoCompletePluginKey, adjustSwimlaneShape, alignElbowSegment, alignPoints, buildDefaultTextsByShape, buildSwimlaneTable, clearSelectedCells, createArrowLineElement, createCell, createDefaultCells, createDefaultFlowchart, createDefaultGeometry, createDefaultRowsOrColumns, createDefaultSwimlane, createGeometryElement, createGeometryElementWithText, createGeometryElementWithoutText, createMultipleTextGeometryElement, createTextElement, createUMLClassOrInterfaceGeometryElement, debugGenerator$1 as debugGenerator, deleteTextManage, drawArrowLine, drawArrowLineArrow, drawBoundReaction, drawGeometry, drawShape, editCell, editText, getArrowLineHandleRefPair, getArrowLinePointers, getArrowLinePoints, getArrowLineTextRectangle, getArrowLines, getAutoCompletePoints, getBasicPointers, getCellWithPoints, getCellsRectangle, getCellsWithPoints, getCenterPointsOnPolygon$1 as getCenterPointsOnPolygon, getConnectionPoint, getCurvePoints, getDefaultBasicShapeProperty, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultSwimlanePoints, getDefaultTextPoints, getDefaultUMLProperty, getDrawDefaultStrokeColor, getDrawHitElement, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFirstFilledDrawElement, getFirstTextOrLineElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryAlign, getGeometryPointers, getHitCell, getHitConnection, getHitConnectorPoint, getHitIndexOfAutoCompletePoint, getHitMultipleGeometryText, getHitShape, getIndexAndDeleteCountByKeyPoint, getLineDashByElement, getLineMemorizedLatest, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getMultipleTextGeometryTextKeys, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedArrowLineElements, getSelectedCells, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedSwimlane, getSelectedTableCellsEditor, getSelectedTableElements, getSnapResizingRef, getSnapResizingRefOptions, getSnappingRef, getSnappingShape, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getSwimlaneCount, getSwimlanePointers, getTextKey, getTextManage, getTextManageByCell, getTextRectangle, getTextShapeProperty, getUMLPointers, getVectorByConnection, handleArrowLineCreating, hasIllegalElbowPoint, insertElement, isCellIncludeText, isDrawElementIncludeText, isDrawElementsIncludeText, isGeometryIncludeText, isHitArrowLine, isHitArrowLineText, isHitDrawElement, isHitEdgeOfShape, isHitElementInside, isHitElementText, isHitPolyLine, isInsideOfShape, isMultipleTextGeometry, isMultipleTextShape, isRectangleHitDrawElement, isRectangleHitElementText, isSelfLoop, isSingleSelectElementByTable, isSingleSelectSwimlane, isSingleSelectTable, isSingleTextGeometry, isSingleTextShape, isSwimlaneWithHeader, isTextExceedingBounds, isUpdatedHandleIndex, isUseDefaultOrthogonalRoute, memorizeLatestShape, memorizeLatestText, rerenderGeometryActive, setSelectedCells, setTextManage, traverseDrawShapes, updateCellIds, updateCellIdsByRowOrColumn, updateColumns, updateRowOrColumnIds, updateRows, withArrowLineAutoComplete, withDraw };
8434
8510
  //# sourceMappingURL=plait-draw.mjs.map