@plait/draw 0.82.0 → 0.83.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { ACTIVE_STROKE_WIDTH, DEFAULT_COLOR, ThemeColorMode, PlaitElement, RectangleClient, getSelectedElements, idCreator, createDebugGenerator, Point, createG, arrowPoints, createPath, distanceBetweenPointAndPoint, drawLinearPath, rotate, catmullRomFitting, PlaitBoard, setStrokeLinecap, findElements, createMask, createRect, getNearestPointBetweenPointAndArc, setPathStrokeLinecap, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPointInPolygon, isLineHitRectangle, rotatePointsByAngle, rotateAntiPointsByElement, getEllipseArcCenter, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, depthFirstRecursion, getIsRecursionFunc, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, getI18nValue, toActiveRectangleFromViewBoxRectangle, getElementById, rotatePointsByElement, PlaitNode, hasValidAngle, toViewBoxPoint, toHostPoint, Direction, rotatePoints, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, getRectangleByElements, isSelectionMoving, drawRectangle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, getNearestPointBetweenPointAndSegments, getEllipseTangentSlope, getVectorFromPointAndSlope, getNearestPointBetweenPointAndEllipse, isPointInEllipse, isPointInRoundRectangle, drawRoundRectangle, getCrossingPointsBetweenEllipseAndSegment, drawLine, getNearestPointBetweenPointAndDiscreteSegments, getNearestPointBetweenPointAndSegment, Path, rgbaToHEX, SELECTION_RECTANGLE_CLASS_NAME, toActivePointFromViewBoxPoint, getHitElementByPoint, WritableClipboardOperationType, WritableClipboardType, addOrCreateClipboardContext, setAngleForG, CursorClass, toActivePoint, temporaryDisableSelection, toScreenPointFromActivePoint, PRESS_AND_MOVE_BUFFER, isMainPointer, throttleRAF, getAngleBetweenPoints, normalizeAngle, degreesToRadians, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, isSelectedElement, isDragging } from '@plait/core';
2
- import { DEFAULT_FILL, Alignment, getMemorizedLatest, memorizeLatest, WithTextPluginKey, TextManage, StrokeStyle, removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, getExtendPoint, getUnitVectorByPointAndPoint, Generator, getPointByVectorComponent, getStrokeLineDash, getPointOnPolyline, buildText, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getFirstTextEditor, sortElementsByArea, isFilled, getTextEditorsByElement, RESIZE_HANDLE_DIAMETER, measureElement, DEFAULT_FONT_FAMILY, getFirstTextManage, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, normalizeShapePoints, resetPointsAfterResize, getDirectionByVector, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_SIZE, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, isCornerHandle, getIndexByResizeHandle, withResize, getSymmetricHandleIndex, getResizeHandlePointByIndex, drawHandle, getDirectionFactorByDirectionComponent, buildClipboardData as buildClipboardData$1, insertClipboardData as insertClipboardData$1, getDirectionByPointOfRectangle, getDirectionFactor, rotateVector, getOppositeDirection, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, PRIMARY_COLOR, CommonElementFlavour, createActiveGenerator, hasResizeHandle, ActiveGenerator, 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, DEFAULT_COLOR, ThemeColorMode, PlaitElement, RectangleClient, getSelectedElements, idCreator, createDebugGenerator, Point, createG, arrowPoints, createPath, distanceBetweenPointAndPoint, drawLinearPath, rotate, catmullRomFitting, PlaitBoard, setStrokeLinecap, findElements, createMask, createRect, getNearestPointBetweenPointAndArc, setPathStrokeLinecap, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPointInPolygon, isLineHitRectangle, rotatePointsByAngle, rotateAntiPointsByElement, getEllipseArcCenter, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, depthFirstRecursion, getIsRecursionFunc, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, getI18nValue, SELECTION_RECTANGLE_CLASS_NAME, toActivePointFromViewBoxPoint, toActiveRectangleFromViewBoxRectangle, drawRectangle, isSelectionMoving, rgbaToHEX, getElementById, rotatePointsByElement, PlaitNode, hasValidAngle, toViewBoxPoint, toHostPoint, Direction, rotatePoints, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, getRectangleByElements, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, getNearestPointBetweenPointAndSegments, getEllipseTangentSlope, getVectorFromPointAndSlope, getNearestPointBetweenPointAndEllipse, isPointInEllipse, isPointInRoundRectangle, drawRoundRectangle, getCrossingPointsBetweenEllipseAndSegment, drawLine, getNearestPointBetweenPointAndDiscreteSegments, getNearestPointBetweenPointAndSegment, Path, getHitElementByPoint, WritableClipboardOperationType, WritableClipboardType, addOrCreateClipboardContext, setAngleForG, toActivePoint, temporaryDisableSelection, toScreenPointFromActivePoint, PRESS_AND_MOVE_BUFFER, CursorClass, isHorizontalDirection, isMainPointer, throttleRAF, getAngleBetweenPoints, normalizeAngle, degreesToRadians, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, isSelectedElement, isDragging } from '@plait/core';
2
+ import { DEFAULT_FILL, Alignment, WithTextPluginKey, TextManage, getMemorizedLatest, memorizeLatest, removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, getExtendPoint, getUnitVectorByPointAndPoint, Generator, getPointByVectorComponent, getStrokeLineDash, StrokeStyle, getPointOnPolyline, buildText, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getFirstTextEditor, sortElementsByArea, isFilled, getTextEditorsByElement, RESIZE_HANDLE_DIAMETER, drawPrimaryHandle, drawFillPrimaryHandle, PRIMARY_COLOR, measureElement, DEFAULT_FONT_FAMILY, getFirstTextManage, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, normalizeShapePoints, resetPointsAfterResize, getDirectionByVector, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_SIZE, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, isCornerHandle, getIndexByResizeHandle, withResize, getSymmetricHandleIndex, getResizeHandlePointByIndex, drawHandle, getDirectionFactorByDirectionComponent, buildClipboardData as buildClipboardData$1, insertClipboardData as insertClipboardData$1, getDirectionByPointOfRectangle, getDirectionFactor, rotateVector, getOppositeDirection, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, CommonElementFlavour, createActiveGenerator, hasResizeHandle, ActiveGenerator, isVirtualKey, isDelete, isSpaceHotkey, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, isResizingByCondition, getRatioByPoint, getTextManages, ImageGenerator, getDirectionByIndex, moveXOfPoint, getXDistanceBetweenPoint, ResizeHandle, addRotating, removeRotating, drawRotateHandle } from '@plait/common';
3
3
  import { TEXT_DEFAULT_HEIGHT, DEFAULT_FONT_SIZE, AlignEditor } from '@plait/text-plugins';
4
4
  import { pointsOnBezierCurves } from 'points-on-curve';
5
5
  import { Editor, Node } from 'slate';
@@ -395,6 +395,9 @@ const getGeometryPointers = () => {
395
395
  const getSwimlanePointers = () => {
396
396
  return Object.keys(SwimlaneDrawSymbols);
397
397
  };
398
+ const getSwimlaneShapes = () => {
399
+ return Object.keys(SwimlaneSymbols);
400
+ };
398
401
  const getBasicPointers = () => {
399
402
  return Object.keys(BasicShapes);
400
403
  };
@@ -472,113 +475,12 @@ const DefaultLineStyle = {
472
475
  };
473
476
  const LINE_TEXT_SPACE = 4;
474
477
  const LINE_AUTO_COMPLETE_DIAMETER = 6;
475
- const LINE_AUTO_COMPLETE_OPACITY = 0.6;
476
- const LINE_AUTO_COMPLETE_HOVERED_OPACITY = 0.8;
477
- const LINE_AUTO_COMPLETE_HOVERED_DIAMETER = 10;
478
+ const LINE_AUTO_COMPLETE_OPACITY = 1;
479
+ const LINE_AUTO_COMPLETE_HOVERED_OPACITY = 1;
480
+ const LINE_AUTO_COMPLETE_HOVERED_DIAMETER = 12;
478
481
  const LINE_ALIGN_TOLERANCE = 3;
479
482
  const LINE_TEXT = '文本';
480
483
 
481
- const getElementShape = (value) => {
482
- if (PlaitDrawElement.isImage(value)) {
483
- return BasicShapes.rectangle;
484
- }
485
- if (PlaitDrawElement.isTable(value)) {
486
- return TableSymbols.table;
487
- }
488
- return value.shape;
489
- };
490
-
491
- const SHAPE_MAX_LENGTH = 6;
492
- const memorizedShape = new WeakMap();
493
- const getMemorizeKey = (element) => {
494
- let key = '';
495
- switch (true) {
496
- case PlaitDrawElement.isText(element): {
497
- key = MemorizeKey.text;
498
- break;
499
- }
500
- case PlaitDrawElement.isBasicShape(element): {
501
- key = MemorizeKey.basicShape;
502
- break;
503
- }
504
- case PlaitDrawElement.isFlowchart(element): {
505
- key = MemorizeKey.flowchart;
506
- break;
507
- }
508
- case PlaitDrawElement.isArrowLine(element): {
509
- key = MemorizeKey.arrowLine;
510
- break;
511
- }
512
- case PlaitDrawElement.isUML(element): {
513
- key = MemorizeKey.UML;
514
- }
515
- }
516
- return key;
517
- };
518
- const getLineMemorizedLatest = () => {
519
- const properties = getMemorizedLatest(MemorizeKey.arrowLine);
520
- return { ...properties } || {};
521
- };
522
- const getMemorizedLatestByPointer = (pointer) => {
523
- let memorizeKey = '';
524
- if (PlaitDrawElement.isBasicShape({ shape: pointer })) {
525
- memorizeKey = pointer === BasicShapes.text ? MemorizeKey.text : MemorizeKey.basicShape;
526
- }
527
- else if (PlaitDrawElement.isUML({ shape: pointer })) {
528
- memorizeKey = MemorizeKey.UML;
529
- }
530
- else {
531
- memorizeKey = MemorizeKey.flowchart;
532
- }
533
- const properties = { ...getMemorizedLatest(memorizeKey) } || {};
534
- const textProperties = { ...properties.text } || {};
535
- delete properties.text;
536
- return { textProperties, geometryProperties: properties };
537
- };
538
- const memorizeLatestText = (element, operations) => {
539
- const memorizeKey = getMemorizeKey(element);
540
- let textMemory = getMemorizedLatest(memorizeKey)?.text || {};
541
- const setNodeOperation = operations.find(operation => operation.type === 'set_node');
542
- if (setNodeOperation) {
543
- const { properties, newProperties } = setNodeOperation;
544
- for (const key in newProperties) {
545
- const value = newProperties[key];
546
- if (value == null) {
547
- delete textMemory[key];
548
- }
549
- else {
550
- textMemory[key] = value;
551
- }
552
- }
553
- for (const key in properties) {
554
- if (!newProperties.hasOwnProperty(key)) {
555
- delete textMemory[key];
556
- }
557
- }
558
- memorizeLatest(memorizeKey, 'text', textMemory);
559
- }
560
- };
561
- const memorizeLatestShape = (board, shape) => {
562
- const shapes = memorizedShape.has(board) ? memorizedShape.get(board) : [];
563
- const shapeIndex = shapes.indexOf(shape);
564
- if (shape === BasicShapes.text || shapeIndex === 0) {
565
- return;
566
- }
567
- if (shapeIndex !== -1) {
568
- shapes.splice(shapeIndex, 1);
569
- }
570
- else {
571
- if (shapes.length === SHAPE_MAX_LENGTH) {
572
- shapes.pop();
573
- }
574
- }
575
- shapes.unshift(shape);
576
- memorizedShape.set(board, shapes);
577
- };
578
- const getMemorizedLatestShape = (board) => {
579
- return memorizedShape.get(board);
580
- };
581
-
582
484
  // TODO: 是否可以完全基于位置定位 TextManager,实现 line 和 多文本 geometry 统一
583
485
  // 一个元素有多个文本时,单纯通过位置无法获取 TextManage,因此这里单独通过 Map 保存关键字 key 和 TextManage 的对应关系
584
486
  // 1. 单文本元素 key 就是元素的 id
@@ -892,20 +794,95 @@ const getSelectedTableCellsEditor = (board) => {
892
794
  return undefined;
893
795
  };
894
796
 
895
- const getStrokeColorByElement = (board, element) => {
896
- const defaultColor = getDrawDefaultStrokeColor(board.theme.themeColorMode);
897
- const strokeColor = element.strokeColor || defaultColor;
898
- return strokeColor;
797
+ const SHAPE_MAX_LENGTH = 6;
798
+ const memorizedShape = new WeakMap();
799
+ const getMemorizeKey = (element) => {
800
+ let key = '';
801
+ switch (true) {
802
+ case PlaitDrawElement.isText(element): {
803
+ key = MemorizeKey.text;
804
+ break;
805
+ }
806
+ case PlaitDrawElement.isBasicShape(element): {
807
+ key = MemorizeKey.basicShape;
808
+ break;
809
+ }
810
+ case PlaitDrawElement.isFlowchart(element): {
811
+ key = MemorizeKey.flowchart;
812
+ break;
813
+ }
814
+ case PlaitDrawElement.isArrowLine(element): {
815
+ key = MemorizeKey.arrowLine;
816
+ break;
817
+ }
818
+ case PlaitDrawElement.isUML(element): {
819
+ key = MemorizeKey.UML;
820
+ }
821
+ }
822
+ return key;
899
823
  };
900
- const getFillByElement = (board, element) => {
901
- const defaultFill = PlaitDrawElement.isFlowchart(element) && isClosedDrawElement(element)
902
- ? getFlowchartDefaultFill(board.theme.themeColorMode)
903
- : DefaultDrawStyle.fill;
904
- const fill = element.fill || defaultFill;
905
- return fill;
824
+ const getLineMemorizedLatest = () => {
825
+ const properties = getMemorizedLatest(MemorizeKey.arrowLine);
826
+ return { ...properties } || {};
906
827
  };
907
- const getStrokeStyleByElement = (board, element) => {
908
- return element.strokeStyle || StrokeStyle.solid;
828
+ const getMemorizedLatestByPointer = (pointer) => {
829
+ let memorizeKey = '';
830
+ if (PlaitDrawElement.isBasicShape({ shape: pointer })) {
831
+ memorizeKey = pointer === BasicShapes.text ? MemorizeKey.text : MemorizeKey.basicShape;
832
+ }
833
+ else if (PlaitDrawElement.isUML({ shape: pointer })) {
834
+ memorizeKey = MemorizeKey.UML;
835
+ }
836
+ else {
837
+ memorizeKey = MemorizeKey.flowchart;
838
+ }
839
+ const properties = { ...getMemorizedLatest(memorizeKey) } || {};
840
+ const textProperties = { ...properties.text } || {};
841
+ delete properties.text;
842
+ return { textProperties, geometryProperties: properties };
843
+ };
844
+ const memorizeLatestText = (element, operations) => {
845
+ const memorizeKey = getMemorizeKey(element);
846
+ let textMemory = getMemorizedLatest(memorizeKey)?.text || {};
847
+ const setNodeOperation = operations.find(operation => operation.type === 'set_node');
848
+ if (setNodeOperation) {
849
+ const { properties, newProperties } = setNodeOperation;
850
+ for (const key in newProperties) {
851
+ const value = newProperties[key];
852
+ if (value == null) {
853
+ delete textMemory[key];
854
+ }
855
+ else {
856
+ textMemory[key] = value;
857
+ }
858
+ }
859
+ for (const key in properties) {
860
+ if (!newProperties.hasOwnProperty(key)) {
861
+ delete textMemory[key];
862
+ }
863
+ }
864
+ memorizeLatest(memorizeKey, 'text', textMemory);
865
+ }
866
+ };
867
+ const memorizeLatestShape = (board, shape) => {
868
+ const shapes = memorizedShape.has(board) ? memorizedShape.get(board) : [];
869
+ const shapeIndex = shapes.indexOf(shape);
870
+ if (shape === BasicShapes.text || shapeIndex === 0) {
871
+ return;
872
+ }
873
+ if (shapeIndex !== -1) {
874
+ shapes.splice(shapeIndex, 1);
875
+ }
876
+ else {
877
+ if (shapes.length === SHAPE_MAX_LENGTH) {
878
+ shapes.pop();
879
+ }
880
+ }
881
+ shapes.unshift(shape);
882
+ memorizedShape.set(board, shapes);
883
+ };
884
+ const getMemorizedLatestShape = (board) => {
885
+ return memorizedShape.get(board);
909
886
  };
910
887
 
911
888
  const debugKey$4 = 'debug:plait:line-mirror';
@@ -1486,7 +1463,7 @@ const Q2C = (points) => {
1486
1463
  }
1487
1464
  return result;
1488
1465
  };
1489
- const handleArrowLineCreating = (board, lineShape, sourcePoint, movingPoint, sourceElement, lineShapeG) => {
1466
+ const handleArrowLineCreating = (board, lineShape, sourcePoint, movingPoint, sourceElement, lineShapeG, options) => {
1490
1467
  const hitElement = getSnappingShape(board, movingPoint);
1491
1468
  const targetConnection = hitElement ? getHitConnection(board, movingPoint, hitElement) : undefined;
1492
1469
  const sourceConnection = sourceElement ? getHitConnection(board, sourcePoint, sourceElement) : undefined;
@@ -1500,7 +1477,8 @@ const handleArrowLineCreating = (board, lineShape, sourcePoint, movingPoint, sou
1500
1477
  targetMarker && delete memorizedLatest.target;
1501
1478
  const temporaryLineElement = createArrowLineElement(lineShape, [sourcePoint, movingPoint], { marker: sourceMarker || ArrowLineMarkerType.none, connection: sourceConnection, boundId: sourceElement?.id }, { marker: targetMarker || ArrowLineMarkerType.arrow, connection: targetConnection, boundId: targetBoundId }, [], {
1502
1479
  strokeWidth: DefaultLineStyle.strokeWidth,
1503
- ...memorizedLatest
1480
+ ...memorizedLatest,
1481
+ ...options
1504
1482
  });
1505
1483
  const linePoints = getArrowLinePoints(board, temporaryLineElement);
1506
1484
  const otherPoint = linePoints[0];
@@ -2244,41 +2222,358 @@ const getDefaultGeometryText = (board) => {
2244
2222
  return getI18nValue(board, DrawI18nKey.geometryText, DefaultTextProperty.text);
2245
2223
  };
2246
2224
 
2247
- const createUMLClassOrInterfaceGeometryElement = (board, shape, points) => {
2248
- const memorizedLatest = getMemorizedLatestByPointer(shape);
2249
- const element = {
2250
- id: idCreator(),
2251
- type: 'geometry',
2252
- angle: 0,
2253
- opacity: 1,
2254
- points,
2255
- strokeWidth: DefaultBasicShapeProperty.strokeWidth,
2256
- ...memorizedLatest.geometryProperties
2257
- };
2258
- let rows;
2259
- let columns;
2260
- if (shape === UMLSymbols.class) {
2261
- rows = [
2262
- {
2263
- id: idCreator(),
2264
- height: 30
2265
- },
2266
- {
2267
- id: idCreator()
2268
- },
2269
- {
2270
- id: idCreator()
2271
- }
2272
- ];
2273
- columns = [
2274
- {
2275
- id: idCreator()
2276
- }
2277
- ];
2225
+ const getStrokeColorByElement = (board, element) => {
2226
+ const defaultColor = getDrawDefaultStrokeColor(board.theme.themeColorMode);
2227
+ const strokeColor = element.strokeColor || defaultColor;
2228
+ return strokeColor;
2229
+ };
2230
+ const getFillByElement = (board, element) => {
2231
+ const defaultFill = PlaitDrawElement.isFlowchart(element) && isClosedDrawElement(element)
2232
+ ? getFlowchartDefaultFill(board.theme.themeColorMode)
2233
+ : DefaultDrawStyle.fill;
2234
+ const fill = element.fill || defaultFill;
2235
+ return fill;
2236
+ };
2237
+ const getStrokeStyleByElement = (board, element) => {
2238
+ return element.strokeStyle || StrokeStyle.solid;
2239
+ };
2240
+
2241
+ class GeometryShapeGenerator extends Generator {
2242
+ canDraw(element, data) {
2243
+ return true;
2278
2244
  }
2279
- else {
2280
- rows = [
2281
- {
2245
+ draw(element, data) {
2246
+ const rectangle = RectangleClient.getRectangleByPoints(element.points);
2247
+ const shape = element.shape;
2248
+ if (shape === BasicShapes.text) {
2249
+ return;
2250
+ }
2251
+ const fill = getFillByElement(this.board, element);
2252
+ const strokeWidth = getStrokeWidthByElement(element);
2253
+ const strokeColor = getStrokeColorByElement(this.board, element);
2254
+ const strokeStyle = getStrokeStyleByElement(this.board, element);
2255
+ const strokeLineDash = getStrokeLineDash(strokeStyle, strokeWidth);
2256
+ return drawGeometry(this.board, RectangleClient.inflate(rectangle, -strokeWidth), shape, {
2257
+ stroke: strokeColor,
2258
+ strokeWidth,
2259
+ fill,
2260
+ strokeLineDash
2261
+ });
2262
+ }
2263
+ }
2264
+
2265
+ function getMiddlePoints(board, element) {
2266
+ const result = [];
2267
+ const shape = element.shape;
2268
+ const hideBuffer = 10;
2269
+ if (shape === ArrowLineShape.straight) {
2270
+ const points = PlaitDrawElement.isArrowLine(element)
2271
+ ? PlaitArrowLine.getPoints(board, element)
2272
+ : element.points;
2273
+ for (let i = 0; i < points.length - 1; i++) {
2274
+ const distance = distanceBetweenPointAndPoint(...points[i], ...points[i + 1]);
2275
+ if (distance < hideBuffer)
2276
+ continue;
2277
+ result.push([(points[i][0] + points[i + 1][0]) / 2, (points[i][1] + points[i + 1][1]) / 2]);
2278
+ }
2279
+ }
2280
+ if (shape === ArrowLineShape.curve) {
2281
+ const points = PlaitDrawElement.isArrowLine(element)
2282
+ ? PlaitArrowLine.getPoints(board, element)
2283
+ : element.points;
2284
+ const pointsOnBezier = PlaitDrawElement.isArrowLine(element)
2285
+ ? getCurvePoints(board, element)
2286
+ : getVectorLinePoints(board, element);
2287
+ if (points.length === 2) {
2288
+ const start = 0;
2289
+ const endIndex = pointsOnBezier.length - 1;
2290
+ const middleIndex = Math.round((start + endIndex) / 2);
2291
+ result.push(pointsOnBezier[middleIndex]);
2292
+ }
2293
+ else {
2294
+ for (let i = 0; i < points.length - 1; i++) {
2295
+ const startIndex = pointsOnBezier.findIndex(point => point[0] === points[i][0] && point[1] === points[i][1]);
2296
+ const endIndex = pointsOnBezier.findIndex(point => point[0] === points[i + 1][0] && point[1] === points[i + 1][1]);
2297
+ const middleIndex = Math.round((startIndex + endIndex) / 2);
2298
+ const distance = distanceBetweenPointAndPoint(...points[i], ...points[i + 1]);
2299
+ if (distance < hideBuffer)
2300
+ continue;
2301
+ result.push(pointsOnBezier[middleIndex]);
2302
+ }
2303
+ }
2304
+ }
2305
+ if (shape === ArrowLineShape.elbow) {
2306
+ const renderPoints = getElbowPoints(board, element);
2307
+ const options = getElbowLineRouteOptions(board, element);
2308
+ if (!isUseDefaultOrthogonalRoute(element, options)) {
2309
+ const [nextSourcePoint, nextTargetPoint] = getNextSourceAndTargetPoints(board, element);
2310
+ for (let i = 0; i < renderPoints.length - 1; i++) {
2311
+ if ((i == 0 && Point.isEquals(renderPoints[i + 1], nextSourcePoint)) ||
2312
+ (i === renderPoints.length - 2 && Point.isEquals(renderPoints[renderPoints.length - 2], nextTargetPoint))) {
2313
+ continue;
2314
+ }
2315
+ const [currentX, currentY] = renderPoints[i];
2316
+ const [nextX, nextY] = renderPoints[i + 1];
2317
+ const middlePoint = [(currentX + nextX) / 2, (currentY + nextY) / 2];
2318
+ result.push(middlePoint);
2319
+ }
2320
+ }
2321
+ }
2322
+ return result;
2323
+ }
2324
+
2325
+ var LineResizeHandle;
2326
+ (function (LineResizeHandle) {
2327
+ LineResizeHandle["source"] = "source";
2328
+ LineResizeHandle["target"] = "target";
2329
+ LineResizeHandle["addHandle"] = "addHandle";
2330
+ })(LineResizeHandle || (LineResizeHandle = {}));
2331
+ const getHitLineResizeHandleRef = (board, element, point) => {
2332
+ let dataPoints = PlaitDrawElement.isArrowLine(element) ? PlaitArrowLine.getPoints(board, element) : element.points;
2333
+ const index = getHitPointIndex(dataPoints, point);
2334
+ if (index !== -1) {
2335
+ const handleIndex = index;
2336
+ if (index === 0) {
2337
+ return { handle: LineResizeHandle.source, handleIndex };
2338
+ }
2339
+ if (index === dataPoints.length - 1) {
2340
+ return { handle: LineResizeHandle.target, handleIndex };
2341
+ }
2342
+ // elbow line, data points only verify source connection point and target connection point
2343
+ if (element.shape !== ArrowLineShape.elbow) {
2344
+ return { handleIndex };
2345
+ }
2346
+ }
2347
+ const middlePoints = getMiddlePoints(board, element);
2348
+ const indexOfMiddlePoints = getHitPointIndex(middlePoints, point);
2349
+ if (indexOfMiddlePoints !== -1) {
2350
+ return {
2351
+ handle: LineResizeHandle.addHandle,
2352
+ handleIndex: indexOfMiddlePoints
2353
+ };
2354
+ }
2355
+ return undefined;
2356
+ };
2357
+ function getHitPointIndex(points, movingPoint) {
2358
+ const rectangles = points.map(point => {
2359
+ return {
2360
+ x: point[0] - RESIZE_HANDLE_DIAMETER / 2,
2361
+ y: point[1] - RESIZE_HANDLE_DIAMETER / 2,
2362
+ width: RESIZE_HANDLE_DIAMETER,
2363
+ height: RESIZE_HANDLE_DIAMETER
2364
+ };
2365
+ });
2366
+ const rectangle = rectangles.find(rectangle => {
2367
+ return RectangleClient.isHit(RectangleClient.getRectangleByPoints([movingPoint, movingPoint]), rectangle);
2368
+ });
2369
+ return rectangle ? rectangles.indexOf(rectangle) : -1;
2370
+ }
2371
+
2372
+ class LineActiveGenerator extends Generator {
2373
+ constructor(board, options = { active: true }) {
2374
+ super(board, options);
2375
+ this.board = board;
2376
+ this.onlySelectedCurrentLine = false;
2377
+ }
2378
+ canDraw(element, data) {
2379
+ if (data.selected) {
2380
+ return true;
2381
+ }
2382
+ else {
2383
+ return false;
2384
+ }
2385
+ }
2386
+ draw(element, data) {
2387
+ const activeG = createG();
2388
+ const selectedElements = getSelectedElements(this.board);
2389
+ this.onlySelectedCurrentLine = selectedElements.length === 1;
2390
+ if (this.onlySelectedCurrentLine) {
2391
+ activeG.classList.add(SELECTION_RECTANGLE_CLASS_NAME);
2392
+ const points = PlaitDrawElement.isArrowLine(element) ? PlaitArrowLine.getPoints(this.board, element) : element.points;
2393
+ let updatePoints = [...points];
2394
+ let elbowNextRenderPoints = [];
2395
+ if (element.shape === ArrowLineShape.elbow) {
2396
+ updatePoints = points.slice(0, 1).concat(points.slice(-1));
2397
+ elbowNextRenderPoints = getNextRenderPoints(this.board, element, data.linePoints);
2398
+ }
2399
+ const activePoints = updatePoints.map((point) => toActivePointFromViewBoxPoint(this.board, point));
2400
+ activePoints.forEach((point) => {
2401
+ const updateHandle = drawPrimaryHandle(this.board, point);
2402
+ activeG.appendChild(updateHandle);
2403
+ });
2404
+ const middlePoints = getMiddlePoints(this.board, element);
2405
+ const activeMiddlePoints = middlePoints.map((point) => toActivePointFromViewBoxPoint(this.board, point));
2406
+ if (!PlaitBoard.hasBeenTextEditing(this.board)) {
2407
+ for (let i = 0; i < activeMiddlePoints.length; i++) {
2408
+ const point = activeMiddlePoints[i];
2409
+ if (element.shape === ArrowLineShape.elbow && elbowNextRenderPoints.length) {
2410
+ const handleIndex = getHitPointIndex(activeMiddlePoints, point);
2411
+ const isUpdateHandleIndex = isUpdatedHandleIndex(this.board, element, [...points], elbowNextRenderPoints, handleIndex);
2412
+ if (isUpdateHandleIndex) {
2413
+ const updateHandle = drawPrimaryHandle(this.board, point);
2414
+ activeG.appendChild(updateHandle);
2415
+ continue;
2416
+ }
2417
+ }
2418
+ const circle = drawFillPrimaryHandle(this.board, point);
2419
+ activeG.appendChild(circle);
2420
+ }
2421
+ }
2422
+ }
2423
+ else {
2424
+ const rectangle = this.board.getRectangle(element);
2425
+ if (rectangle) {
2426
+ const activeRectangle = toActiveRectangleFromViewBoxRectangle(this.board, rectangle);
2427
+ let opacity = '0.5';
2428
+ if (activeRectangle.height === 0 || activeRectangle.width === 0) {
2429
+ opacity = '0.8';
2430
+ }
2431
+ const strokeG = drawRectangle(this.board, activeRectangle, {
2432
+ stroke: PRIMARY_COLOR,
2433
+ strokeWidth: DefaultDrawActiveStyle.selectionStrokeWidth
2434
+ });
2435
+ strokeG.style.opacity = opacity;
2436
+ activeG.appendChild(strokeG);
2437
+ }
2438
+ }
2439
+ return activeG;
2440
+ }
2441
+ needUpdate() {
2442
+ const selectedElements = getSelectedElements(this.board);
2443
+ const onlySelectedCurrentLine = selectedElements.length === 1;
2444
+ return onlySelectedCurrentLine !== this.onlySelectedCurrentLine;
2445
+ }
2446
+ }
2447
+
2448
+ class ArrowLineAutoCompleteGenerator extends Generator {
2449
+ static { this.key = 'line-auto-complete-generator'; }
2450
+ constructor(board) {
2451
+ super(board, { active: true });
2452
+ this.board = board;
2453
+ this.hoverElement = null;
2454
+ }
2455
+ canDraw(element, data) {
2456
+ const selectedElements = getSelectedElements(this.board);
2457
+ if (data.selected && selectedElements.length === 1 && !isSelectionMoving(this.board)) {
2458
+ return true;
2459
+ }
2460
+ else {
2461
+ return false;
2462
+ }
2463
+ }
2464
+ draw(element, data) {
2465
+ this.autoCompleteG = createG();
2466
+ const middlePoints = getAutoCompletePoints(this.board, element, true);
2467
+ middlePoints.forEach((point, index) => {
2468
+ const circle = drawCircle(PlaitBoard.getRoughSVG(this.board), point, LINE_AUTO_COMPLETE_DIAMETER, {
2469
+ stroke: 'none',
2470
+ fill: rgbaToHEX(PRIMARY_COLOR, LINE_AUTO_COMPLETE_OPACITY),
2471
+ fillStyle: 'solid'
2472
+ });
2473
+ circle.classList.add(`line-auto-complete-${index}`);
2474
+ this.autoCompleteG.appendChild(circle);
2475
+ });
2476
+ return this.autoCompleteG;
2477
+ }
2478
+ removeAutoCompleteG(index) {
2479
+ this.hoverElement = this.autoCompleteG.querySelector(`.line-auto-complete-${index}`);
2480
+ this.hoverElement.style.visibility = 'hidden';
2481
+ }
2482
+ recoverAutoCompleteG() {
2483
+ if (this.hoverElement) {
2484
+ this.hoverElement.style.visibility = 'visible';
2485
+ this.hoverElement = null;
2486
+ }
2487
+ }
2488
+ }
2489
+
2490
+ class SingleTextGenerator extends TextGenerator {
2491
+ get textManage() {
2492
+ return this.textManages[0];
2493
+ }
2494
+ constructor(board, element, text, options) {
2495
+ super(board, element, [{ id: element.id, text: text, textHeight: element.textHeight }], options);
2496
+ }
2497
+ update(element, previousText, currentText, elementG) {
2498
+ if (!isMultipleTextGeometry(element)) {
2499
+ super.update(element, [{ text: previousText, id: element.id, textHeight: element.textHeight }], [{ text: currentText, id: element.id, textHeight: element.textHeight }], elementG);
2500
+ }
2501
+ }
2502
+ }
2503
+
2504
+ class TableGenerator extends Generator {
2505
+ canDraw(element, data) {
2506
+ return true;
2507
+ }
2508
+ draw(element, data) {
2509
+ const rectangle = RectangleClient.getRectangleByPoints(element.points);
2510
+ const strokeWidth = getStrokeWidthByElement(element);
2511
+ const strokeColor = getStrokeColorByElement(this.board, element);
2512
+ const strokeStyle = getStrokeStyleByElement(this.board, element);
2513
+ const strokeLineDash = getStrokeLineDash(strokeStyle, strokeWidth);
2514
+ return getEngine(TableSymbols.table).draw(this.board, rectangle, {
2515
+ strokeWidth,
2516
+ stroke: strokeColor,
2517
+ strokeLineDash
2518
+ }, {
2519
+ element: element
2520
+ });
2521
+ }
2522
+ }
2523
+
2524
+ const getElementShape = (value) => {
2525
+ if (PlaitDrawElement.isImage(value)) {
2526
+ return BasicShapes.rectangle;
2527
+ }
2528
+ if (PlaitDrawElement.isTable(value)) {
2529
+ return TableSymbols.table;
2530
+ }
2531
+ return value.shape;
2532
+ };
2533
+ const getGeometryGeneratorByShape = (board, shape) => {
2534
+ if (PlaitDrawElement.isUMLClassOrInterface({ shape: shape })) {
2535
+ return new TableGenerator(board);
2536
+ }
2537
+ else {
2538
+ return new GeometryShapeGenerator(board);
2539
+ }
2540
+ };
2541
+
2542
+ const createUMLClassOrInterfaceGeometryElement = (board, shape, points) => {
2543
+ const memorizedLatest = getMemorizedLatestByPointer(shape);
2544
+ const element = {
2545
+ id: idCreator(),
2546
+ type: 'geometry',
2547
+ angle: 0,
2548
+ opacity: 1,
2549
+ points,
2550
+ strokeWidth: DefaultBasicShapeProperty.strokeWidth,
2551
+ ...memorizedLatest.geometryProperties
2552
+ };
2553
+ let rows;
2554
+ let columns;
2555
+ if (shape === UMLSymbols.class) {
2556
+ rows = [
2557
+ {
2558
+ id: idCreator(),
2559
+ height: 30
2560
+ },
2561
+ {
2562
+ id: idCreator()
2563
+ },
2564
+ {
2565
+ id: idCreator()
2566
+ }
2567
+ ];
2568
+ columns = [
2569
+ {
2570
+ id: idCreator()
2571
+ }
2572
+ ];
2573
+ }
2574
+ else {
2575
+ rows = [
2576
+ {
2282
2577
  id: idCreator(),
2283
2578
  height: 50
2284
2579
  },
@@ -2934,13 +3229,16 @@ const getSwimlaneCount = (swimlane) => {
2934
3229
  const isSwimlaneWithHeader = (shape) => {
2935
3230
  return [SwimlaneDrawSymbols.swimlaneHorizontalWithHeader, SwimlaneDrawSymbols.swimlaneVerticalWithHeader].includes(shape);
2936
3231
  };
3232
+ const isSwimlaneShape = (shape) => {
3233
+ return getSwimlaneShapes().includes(shape);
3234
+ };
2937
3235
  const adjustSwimlaneShape = (shape) => {
2938
3236
  return [SwimlaneDrawSymbols.swimlaneHorizontalWithHeader, SwimlaneDrawSymbols.swimlaneHorizontal].includes(shape)
2939
3237
  ? SwimlaneSymbols.swimlaneHorizontal
2940
3238
  : SwimlaneSymbols.swimlaneVertical;
2941
3239
  };
2942
- const isSwimlanePointers = (board) => {
2943
- return PlaitBoard.isInPointer(board, getSwimlanePointers());
3240
+ const isSwimlanePointers = (board, pointer = board.pointer) => {
3241
+ return getSwimlanePointers().includes(pointer);
2944
3242
  };
2945
3243
 
2946
3244
  const updateSwimlaneCount = (board, swimlane, count) => {
@@ -3730,66 +4028,6 @@ function drawIsometricSnapLines(board, activePoints, snapRectangles, resizeSnapO
3730
4028
  return drawSolidLines(board, isometricLines);
3731
4029
  }
3732
4030
 
3733
- function getMiddlePoints(board, element) {
3734
- const result = [];
3735
- const shape = element.shape;
3736
- const hideBuffer = 10;
3737
- if (shape === ArrowLineShape.straight) {
3738
- const points = PlaitDrawElement.isArrowLine(element)
3739
- ? PlaitArrowLine.getPoints(board, element)
3740
- : element.points;
3741
- for (let i = 0; i < points.length - 1; i++) {
3742
- const distance = distanceBetweenPointAndPoint(...points[i], ...points[i + 1]);
3743
- if (distance < hideBuffer)
3744
- continue;
3745
- result.push([(points[i][0] + points[i + 1][0]) / 2, (points[i][1] + points[i + 1][1]) / 2]);
3746
- }
3747
- }
3748
- if (shape === ArrowLineShape.curve) {
3749
- const points = PlaitDrawElement.isArrowLine(element)
3750
- ? PlaitArrowLine.getPoints(board, element)
3751
- : element.points;
3752
- const pointsOnBezier = PlaitDrawElement.isArrowLine(element)
3753
- ? getCurvePoints(board, element)
3754
- : getVectorLinePoints(board, element);
3755
- if (points.length === 2) {
3756
- const start = 0;
3757
- const endIndex = pointsOnBezier.length - 1;
3758
- const middleIndex = Math.round((start + endIndex) / 2);
3759
- result.push(pointsOnBezier[middleIndex]);
3760
- }
3761
- else {
3762
- for (let i = 0; i < points.length - 1; i++) {
3763
- const startIndex = pointsOnBezier.findIndex(point => point[0] === points[i][0] && point[1] === points[i][1]);
3764
- const endIndex = pointsOnBezier.findIndex(point => point[0] === points[i + 1][0] && point[1] === points[i + 1][1]);
3765
- const middleIndex = Math.round((startIndex + endIndex) / 2);
3766
- const distance = distanceBetweenPointAndPoint(...points[i], ...points[i + 1]);
3767
- if (distance < hideBuffer)
3768
- continue;
3769
- result.push(pointsOnBezier[middleIndex]);
3770
- }
3771
- }
3772
- }
3773
- if (shape === ArrowLineShape.elbow) {
3774
- const renderPoints = getElbowPoints(board, element);
3775
- const options = getElbowLineRouteOptions(board, element);
3776
- if (!isUseDefaultOrthogonalRoute(element, options)) {
3777
- const [nextSourcePoint, nextTargetPoint] = getNextSourceAndTargetPoints(board, element);
3778
- for (let i = 0; i < renderPoints.length - 1; i++) {
3779
- if ((i == 0 && Point.isEquals(renderPoints[i + 1], nextSourcePoint)) ||
3780
- (i === renderPoints.length - 2 && Point.isEquals(renderPoints[renderPoints.length - 2], nextTargetPoint))) {
3781
- continue;
3782
- }
3783
- const [currentX, currentY] = renderPoints[i];
3784
- const [nextX, nextY] = renderPoints[i + 1];
3785
- const middlePoint = [(currentX + nextX) / 2, (currentY + nextY) / 2];
3786
- result.push(middlePoint);
3787
- }
3788
- }
3789
- }
3790
- return result;
3791
- }
3792
-
3793
4031
  const buildClipboardData = (board, elements, startPoint) => {
3794
4032
  return buildClipboardData$1(board, elements, startPoint, (element) => {
3795
4033
  if (PlaitDrawElement.isArrowLine(element)) {
@@ -6993,121 +7231,41 @@ const PlaitDrawElement = {
6993
7231
  else {
6994
7232
  return false;
6995
7233
  }
6996
- },
6997
- isShapeElement: (value) => {
6998
- return (PlaitDrawElement.isImage(value) ||
6999
- PlaitDrawElement.isGeometry(value) ||
7000
- PlaitDrawElement.isTable(value) ||
7001
- PlaitDrawElement.isSwimlane(value));
7002
- },
7003
- isBasicShape: (value) => {
7004
- return Object.keys(BasicShapes).includes(value.shape);
7005
- },
7006
- isFlowchart: (value) => {
7007
- return Object.keys(FlowchartSymbols).includes(value.shape);
7008
- },
7009
- isUML: (value) => {
7010
- return Object.keys(UMLSymbols).includes(value.shape);
7011
- },
7012
- isSwimlane: (value) => {
7013
- return value.type === 'swimlane';
7014
- },
7015
- isVerticalSwimlane: (value) => {
7016
- return PlaitDrawElement.isSwimlane(value) && value.shape === SwimlaneSymbols.swimlaneVertical;
7017
- },
7018
- isHorizontalSwimlane: (value) => {
7019
- return PlaitDrawElement.isSwimlane(value) && value.shape === SwimlaneSymbols.swimlaneHorizontal;
7020
- },
7021
- isUMLClassOrInterface: (value) => {
7022
- return Object.keys(UMLSymbols).includes(value.shape) && [UMLSymbols.class, UMLSymbols.interface].includes(value.shape);
7023
- },
7024
- isGeometryByTable: (value) => {
7025
- return PlaitDrawElement.isUMLClassOrInterface(value);
7026
- },
7027
- isElementByTable: (value) => {
7028
- return PlaitDrawElement.isTable(value) || PlaitDrawElement.isSwimlane(value) || PlaitDrawElement.isGeometryByTable(value);
7029
- }
7030
- };
7031
-
7032
- class GeometryShapeGenerator extends Generator {
7033
- canDraw(element, data) {
7034
- return true;
7035
- }
7036
- draw(element, data) {
7037
- const rectangle = RectangleClient.getRectangleByPoints(element.points);
7038
- const shape = element.shape;
7039
- if (shape === BasicShapes.text) {
7040
- return;
7041
- }
7042
- const fill = getFillByElement(this.board, element);
7043
- const strokeWidth = getStrokeWidthByElement(element);
7044
- const strokeColor = getStrokeColorByElement(this.board, element);
7045
- const strokeStyle = getStrokeStyleByElement(this.board, element);
7046
- const strokeLineDash = getStrokeLineDash(strokeStyle, strokeWidth);
7047
- return drawGeometry(this.board, RectangleClient.inflate(rectangle, -strokeWidth), shape, {
7048
- stroke: strokeColor,
7049
- strokeWidth,
7050
- fill,
7051
- strokeLineDash
7052
- });
7053
- }
7054
- }
7055
-
7056
- class ArrowLineAutoCompleteGenerator extends Generator {
7057
- static { this.key = 'line-auto-complete-generator'; }
7058
- constructor(board) {
7059
- super(board, { active: true });
7060
- this.board = board;
7061
- this.hoverElement = null;
7062
- }
7063
- canDraw(element, data) {
7064
- const selectedElements = getSelectedElements(this.board);
7065
- if (data.selected && selectedElements.length === 1 && !isSelectionMoving(this.board)) {
7066
- return true;
7067
- }
7068
- else {
7069
- return false;
7070
- }
7071
- }
7072
- draw(element, data) {
7073
- this.autoCompleteG = createG();
7074
- const middlePoints = getAutoCompletePoints(this.board, element, true);
7075
- middlePoints.forEach((point, index) => {
7076
- const circle = drawCircle(PlaitBoard.getRoughSVG(this.board), point, LINE_AUTO_COMPLETE_DIAMETER, {
7077
- stroke: 'none',
7078
- fill: rgbaToHEX(PRIMARY_COLOR, LINE_AUTO_COMPLETE_OPACITY),
7079
- fillStyle: 'solid'
7080
- });
7081
- circle.classList.add(`line-auto-complete-${index}`);
7082
- this.autoCompleteG.appendChild(circle);
7083
- });
7084
- return this.autoCompleteG;
7085
- }
7086
- removeAutoCompleteG(index) {
7087
- this.hoverElement = this.autoCompleteG.querySelector(`.line-auto-complete-${index}`);
7088
- this.hoverElement.style.visibility = 'hidden';
7089
- }
7090
- recoverAutoCompleteG() {
7091
- if (this.hoverElement) {
7092
- this.hoverElement.style.visibility = 'visible';
7093
- this.hoverElement = null;
7094
- }
7095
- }
7096
- }
7097
-
7098
- class SingleTextGenerator extends TextGenerator {
7099
- get textManage() {
7100
- return this.textManages[0];
7101
- }
7102
- constructor(board, element, text, options) {
7103
- super(board, element, [{ id: element.id, text: text, textHeight: element.textHeight }], options);
7104
- }
7105
- update(element, previousText, currentText, elementG) {
7106
- if (!isMultipleTextGeometry(element)) {
7107
- super.update(element, [{ text: previousText, id: element.id, textHeight: element.textHeight }], [{ text: currentText, id: element.id, textHeight: element.textHeight }], elementG);
7108
- }
7234
+ },
7235
+ isShapeElement: (value) => {
7236
+ return (PlaitDrawElement.isImage(value) ||
7237
+ PlaitDrawElement.isGeometry(value) ||
7238
+ PlaitDrawElement.isTable(value) ||
7239
+ PlaitDrawElement.isSwimlane(value));
7240
+ },
7241
+ isBasicShape: (value) => {
7242
+ return Object.keys(BasicShapes).includes(value.shape);
7243
+ },
7244
+ isFlowchart: (value) => {
7245
+ return Object.keys(FlowchartSymbols).includes(value.shape);
7246
+ },
7247
+ isUML: (value) => {
7248
+ return Object.keys(UMLSymbols).includes(value.shape);
7249
+ },
7250
+ isSwimlane: (value) => {
7251
+ return value.type === 'swimlane';
7252
+ },
7253
+ isVerticalSwimlane: (value) => {
7254
+ return PlaitDrawElement.isSwimlane(value) && value.shape === SwimlaneSymbols.swimlaneVertical;
7255
+ },
7256
+ isHorizontalSwimlane: (value) => {
7257
+ return PlaitDrawElement.isSwimlane(value) && value.shape === SwimlaneSymbols.swimlaneHorizontal;
7258
+ },
7259
+ isUMLClassOrInterface: (value) => {
7260
+ return Object.keys(UMLSymbols).includes(value.shape) && [UMLSymbols.class, UMLSymbols.interface].includes(value.shape);
7261
+ },
7262
+ isGeometryByTable: (value) => {
7263
+ return PlaitDrawElement.isUMLClassOrInterface(value);
7264
+ },
7265
+ isElementByTable: (value) => {
7266
+ return PlaitDrawElement.isTable(value) || PlaitDrawElement.isSwimlane(value) || PlaitDrawElement.isGeometryByTable(value);
7109
7267
  }
7110
- }
7268
+ };
7111
7269
 
7112
7270
  class GeometryComponent extends CommonElementFlavour {
7113
7271
  constructor() {
@@ -7244,129 +7402,6 @@ class GeometryComponent extends CommonElementFlavour {
7244
7402
  }
7245
7403
  }
7246
7404
 
7247
- var LineResizeHandle;
7248
- (function (LineResizeHandle) {
7249
- LineResizeHandle["source"] = "source";
7250
- LineResizeHandle["target"] = "target";
7251
- LineResizeHandle["addHandle"] = "addHandle";
7252
- })(LineResizeHandle || (LineResizeHandle = {}));
7253
- const getHitLineResizeHandleRef = (board, element, point) => {
7254
- let dataPoints = PlaitDrawElement.isArrowLine(element) ? PlaitArrowLine.getPoints(board, element) : element.points;
7255
- const index = getHitPointIndex(dataPoints, point);
7256
- if (index !== -1) {
7257
- const handleIndex = index;
7258
- if (index === 0) {
7259
- return { handle: LineResizeHandle.source, handleIndex };
7260
- }
7261
- if (index === dataPoints.length - 1) {
7262
- return { handle: LineResizeHandle.target, handleIndex };
7263
- }
7264
- // elbow line, data points only verify source connection point and target connection point
7265
- if (element.shape !== ArrowLineShape.elbow) {
7266
- return { handleIndex };
7267
- }
7268
- }
7269
- const middlePoints = getMiddlePoints(board, element);
7270
- const indexOfMiddlePoints = getHitPointIndex(middlePoints, point);
7271
- if (indexOfMiddlePoints !== -1) {
7272
- return {
7273
- handle: LineResizeHandle.addHandle,
7274
- handleIndex: indexOfMiddlePoints
7275
- };
7276
- }
7277
- return undefined;
7278
- };
7279
- function getHitPointIndex(points, movingPoint) {
7280
- const rectangles = points.map(point => {
7281
- return {
7282
- x: point[0] - RESIZE_HANDLE_DIAMETER / 2,
7283
- y: point[1] - RESIZE_HANDLE_DIAMETER / 2,
7284
- width: RESIZE_HANDLE_DIAMETER,
7285
- height: RESIZE_HANDLE_DIAMETER
7286
- };
7287
- });
7288
- const rectangle = rectangles.find(rectangle => {
7289
- return RectangleClient.isHit(RectangleClient.getRectangleByPoints([movingPoint, movingPoint]), rectangle);
7290
- });
7291
- return rectangle ? rectangles.indexOf(rectangle) : -1;
7292
- }
7293
-
7294
- class LineActiveGenerator extends Generator {
7295
- constructor(board, options = { active: true }) {
7296
- super(board, options);
7297
- this.board = board;
7298
- this.onlySelectedCurrentLine = false;
7299
- }
7300
- canDraw(element, data) {
7301
- if (data.selected) {
7302
- return true;
7303
- }
7304
- else {
7305
- return false;
7306
- }
7307
- }
7308
- draw(element, data) {
7309
- const activeG = createG();
7310
- const selectedElements = getSelectedElements(this.board);
7311
- this.onlySelectedCurrentLine = selectedElements.length === 1;
7312
- if (this.onlySelectedCurrentLine) {
7313
- activeG.classList.add(SELECTION_RECTANGLE_CLASS_NAME);
7314
- const points = PlaitDrawElement.isArrowLine(element) ? PlaitArrowLine.getPoints(this.board, element) : element.points;
7315
- let updatePoints = [...points];
7316
- let elbowNextRenderPoints = [];
7317
- if (element.shape === ArrowLineShape.elbow) {
7318
- updatePoints = points.slice(0, 1).concat(points.slice(-1));
7319
- elbowNextRenderPoints = getNextRenderPoints(this.board, element, data.linePoints);
7320
- }
7321
- const activePoints = updatePoints.map((point) => toActivePointFromViewBoxPoint(this.board, point));
7322
- activePoints.forEach((point) => {
7323
- const updateHandle = drawPrimaryHandle(this.board, point);
7324
- activeG.appendChild(updateHandle);
7325
- });
7326
- const middlePoints = getMiddlePoints(this.board, element);
7327
- const activeMiddlePoints = middlePoints.map((point) => toActivePointFromViewBoxPoint(this.board, point));
7328
- if (!PlaitBoard.hasBeenTextEditing(this.board)) {
7329
- for (let i = 0; i < activeMiddlePoints.length; i++) {
7330
- const point = activeMiddlePoints[i];
7331
- if (element.shape === ArrowLineShape.elbow && elbowNextRenderPoints.length) {
7332
- const handleIndex = getHitPointIndex(activeMiddlePoints, point);
7333
- const isUpdateHandleIndex = isUpdatedHandleIndex(this.board, element, [...points], elbowNextRenderPoints, handleIndex);
7334
- if (isUpdateHandleIndex) {
7335
- const updateHandle = drawPrimaryHandle(this.board, point);
7336
- activeG.appendChild(updateHandle);
7337
- continue;
7338
- }
7339
- }
7340
- const circle = drawFillPrimaryHandle(this.board, point);
7341
- activeG.appendChild(circle);
7342
- }
7343
- }
7344
- }
7345
- else {
7346
- const rectangle = this.board.getRectangle(element);
7347
- if (rectangle) {
7348
- const activeRectangle = toActiveRectangleFromViewBoxRectangle(this.board, rectangle);
7349
- let opacity = '0.5';
7350
- if (activeRectangle.height === 0 || activeRectangle.width === 0) {
7351
- opacity = '0.8';
7352
- }
7353
- const strokeG = drawRectangle(this.board, activeRectangle, {
7354
- stroke: PRIMARY_COLOR,
7355
- strokeWidth: DefaultDrawActiveStyle.selectionStrokeWidth
7356
- });
7357
- strokeG.style.opacity = opacity;
7358
- activeG.appendChild(strokeG);
7359
- }
7360
- }
7361
- return activeG;
7362
- }
7363
- needUpdate() {
7364
- const selectedElements = getSelectedElements(this.board);
7365
- const onlySelectedCurrentLine = selectedElements.length === 1;
7366
- return onlySelectedCurrentLine !== this.onlySelectedCurrentLine;
7367
- }
7368
- }
7369
-
7370
7405
  const debugKey = 'debug:plait:line-turning';
7371
7406
  const debugGenerator = createDebugGenerator(debugKey);
7372
7407
  class ArrowLineComponent extends CommonElementFlavour {
@@ -7613,26 +7648,6 @@ const withDrawHotkey = (board) => {
7613
7648
  return board;
7614
7649
  };
7615
7650
 
7616
- class TableGenerator extends Generator {
7617
- canDraw(element, data) {
7618
- return true;
7619
- }
7620
- draw(element, data) {
7621
- const rectangle = RectangleClient.getRectangleByPoints(element.points);
7622
- const strokeWidth = getStrokeWidthByElement(element);
7623
- const strokeColor = getStrokeColorByElement(this.board, element);
7624
- const strokeStyle = getStrokeStyleByElement(this.board, element);
7625
- const strokeLineDash = getStrokeLineDash(strokeStyle, strokeWidth);
7626
- return getEngine(TableSymbols.table).draw(this.board, rectangle, {
7627
- strokeWidth,
7628
- stroke: strokeColor,
7629
- strokeLineDash
7630
- }, {
7631
- element: element
7632
- });
7633
- }
7634
- }
7635
-
7636
7651
  const isGeometryDndMode = (board) => {
7637
7652
  const geometryPointers = getGeometryPointers();
7638
7653
  const isGeometryPointer = PlaitBoard.isInPointer(board, geometryPointers);
@@ -7645,14 +7660,6 @@ const isGeometryDrawingMode = (board) => {
7645
7660
  const drawingMode = isGeometryPointer && isDrawingMode(board);
7646
7661
  return drawingMode;
7647
7662
  };
7648
- const getGeometryGeneratorByShape = (board, shape) => {
7649
- if (PlaitDrawElement.isUMLClassOrInterface({ shape: shape })) {
7650
- return new TableGenerator(board);
7651
- }
7652
- else {
7653
- return new GeometryShapeGenerator(board);
7654
- }
7655
- };
7656
7663
  const withGeometryCreateByDrag = (board) => {
7657
7664
  const { pointerMove, globalPointerUp, pointerUp } = board;
7658
7665
  let geometryShapeG = null;
@@ -8263,44 +8270,8 @@ class ImageComponent extends CommonElementFlavour {
8263
8270
  }
8264
8271
  }
8265
8272
 
8266
- const withArrowLineAutoCompleteReaction = (board) => {
8267
- const { pointerMove } = board;
8268
- let reactionG = null;
8269
- board.pointerMove = (event) => {
8270
- reactionG?.remove();
8271
- PlaitBoard.getBoardContainer(board).classList.remove(CursorClass.crosshair);
8272
- const selectedElements = getSelectedDrawElements(board);
8273
- const targetElement = selectedElements.length === 1 && selectedElements[0];
8274
- const activePoint = toActivePoint(board, event.x, event.y);
8275
- if (!PlaitBoard.isReadonly(board) && !isSelectionMoving(board) && targetElement && PlaitDrawElement.isShapeElement(targetElement)) {
8276
- const points = getAutoCompletePoints(board, targetElement, true);
8277
- const hitIndex = getHitIndexOfAutoCompletePoint(rotateAntiPointsByElement(board, activePoint, targetElement, true) || activePoint, points);
8278
- const hitPoint = points[hitIndex];
8279
- const ref = PlaitElement.getElementRef(targetElement);
8280
- const lineAutoCompleteGenerator = ref.getGenerator(ArrowLineAutoCompleteGenerator.key);
8281
- lineAutoCompleteGenerator.recoverAutoCompleteG();
8282
- if (hitPoint) {
8283
- lineAutoCompleteGenerator?.removeAutoCompleteG(hitIndex);
8284
- reactionG = drawCircle(PlaitBoard.getRoughSVG(board), hitPoint, LINE_AUTO_COMPLETE_HOVERED_DIAMETER, {
8285
- stroke: 'none',
8286
- fill: rgbaToHEX(PRIMARY_COLOR, LINE_AUTO_COMPLETE_HOVERED_OPACITY),
8287
- fillStyle: 'solid'
8288
- });
8289
- PlaitBoard.getActiveHost(board).append(reactionG);
8290
- PlaitBoard.getBoardContainer(board).classList.add(CursorClass.crosshair);
8291
- if (hasValidAngle(targetElement)) {
8292
- const rectangle = board.getRectangle(targetElement);
8293
- const activeRectangle = toActiveRectangleFromViewBoxRectangle(board, rectangle);
8294
- setAngleForG(reactionG, RectangleClient.getCenterPoint(activeRectangle), targetElement.angle);
8295
- }
8296
- }
8297
- }
8298
- pointerMove(event);
8299
- };
8300
- return board;
8301
- };
8302
-
8303
8273
  const WithArrowLineAutoCompletePluginKey = 'plait-arrow-line-auto-complete-plugin-key';
8274
+ const BOARD_TO_PRE_COMMIT = new WeakMap();
8304
8275
  const withArrowLineAutoComplete = (board) => {
8305
8276
  const { pointerDown, pointerMove, globalPointerUp } = board;
8306
8277
  let autoCompletePoint = null;
@@ -8331,7 +8302,7 @@ const withArrowLineAutoComplete = (board) => {
8331
8302
  let movingPoint = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
8332
8303
  if (autoCompletePoint && sourceElement) {
8333
8304
  const distance = distanceBetweenPointAndPoint(...(rotateAntiPointsByElement(board, movingPoint, sourceElement) || movingPoint), ...autoCompletePoint);
8334
- if (distance > PRESS_AND_MOVE_BUFFER) {
8305
+ if (distance > PRESS_AND_MOVE_BUFFER * 2) {
8335
8306
  const rectangle = RectangleClient.getRectangleByPoints(sourceElement.points);
8336
8307
  const shape = getElementShape(sourceElement);
8337
8308
  const engine = getEngine(shape);
@@ -8356,6 +8327,14 @@ const withArrowLineAutoComplete = (board) => {
8356
8327
  const afterComplete = board.getPluginOptions(WithArrowLineAutoCompletePluginKey)?.afterComplete;
8357
8328
  afterComplete && afterComplete(temporaryElement);
8358
8329
  }
8330
+ else {
8331
+ const preCommitRef = BOARD_TO_PRE_COMMIT.get(board);
8332
+ if (preCommitRef) {
8333
+ Transforms.insertNode(board, preCommitRef.temporaryArrowLineElement, [board.children.length]);
8334
+ insertElement(board, preCommitRef.temporaryShapeElement);
8335
+ BOARD_TO_PRE_COMMIT.delete(board);
8336
+ }
8337
+ }
8359
8338
  if (autoCompletePoint) {
8360
8339
  BoardTransforms.updatePointerType(board, PlaitPointerType.selection);
8361
8340
  autoCompletePoint = null;
@@ -8369,6 +8348,101 @@ const withArrowLineAutoComplete = (board) => {
8369
8348
  return board;
8370
8349
  };
8371
8350
 
8351
+ const PREVIEW_ARROW_LINE_DISTANCE = 100;
8352
+ const withArrowLineAutoCompleteReaction = (board) => {
8353
+ const { pointerMove, pointerLeave, globalPointerUp } = board;
8354
+ let reactionG = null;
8355
+ let temporaryArrowLineElement = null;
8356
+ let temporaryShapeElement = null;
8357
+ let temporaryArrowLineG = null;
8358
+ let temporaryShapeG = null;
8359
+ board.pointerMove = (event) => {
8360
+ reactionG?.remove();
8361
+ PlaitBoard.getBoardContainer(board).classList.remove(CursorClass.crosshair);
8362
+ const selectedElements = getSelectedDrawElements(board);
8363
+ temporaryArrowLineG?.remove();
8364
+ temporaryShapeG?.remove();
8365
+ const originElement = selectedElements.length === 1 && selectedElements[0];
8366
+ const activePoint = toActivePoint(board, event.x, event.y);
8367
+ if (!PlaitBoard.isReadonly(board) && !isSelectionMoving(board) && originElement && PlaitDrawElement.isShapeElement(originElement)) {
8368
+ const points = getAutoCompletePoints(board, originElement, true);
8369
+ const hitIndex = getHitIndexOfAutoCompletePoint(rotateAntiPointsByElement(board, activePoint, originElement, true) || activePoint, points);
8370
+ const hitPoint = points[hitIndex];
8371
+ const ref = PlaitElement.getElementRef(originElement);
8372
+ const lineAutoCompleteGenerator = ref.getGenerator(ArrowLineAutoCompleteGenerator.key);
8373
+ lineAutoCompleteGenerator.recoverAutoCompleteG();
8374
+ if (hitPoint) {
8375
+ // function 1: dnd
8376
+ reactionG = drawCircle(PlaitBoard.getRoughSVG(board), hitPoint, LINE_AUTO_COMPLETE_HOVERED_DIAMETER, {
8377
+ stroke: 'none',
8378
+ fill: rgbaToHEX(PRIMARY_COLOR, LINE_AUTO_COMPLETE_HOVERED_OPACITY),
8379
+ fillStyle: 'solid'
8380
+ });
8381
+ PlaitBoard.getActiveHost(board).append(reactionG);
8382
+ PlaitBoard.getBoardContainer(board).classList.add(CursorClass.crosshair);
8383
+ if (hasValidAngle(originElement)) {
8384
+ const rectangle = board.getRectangle(originElement);
8385
+ const activeRectangle = toActiveRectangleFromViewBoxRectangle(board, rectangle);
8386
+ setAngleForG(reactionG, RectangleClient.getCenterPoint(activeRectangle), originElement.angle);
8387
+ }
8388
+ // function 2: hover to preview and click to commit
8389
+ if (PlaitDrawElement.isGeometry(originElement) && !PlaitDrawElement.isText(originElement)) {
8390
+ const originRect = RectangleClient.getRectangleByPoints(originElement.points);
8391
+ let arrowLineStartPoint = RectangleClient.getEdgeCenterPoints(originRect)[hitIndex];
8392
+ const arrowLineDirection = getDirectionByIndex(hitIndex);
8393
+ let arrowLineEndPoint = moveXOfPoint(arrowLineStartPoint, PREVIEW_ARROW_LINE_DISTANCE, arrowLineDirection);
8394
+ const geometryGenerator = getGeometryGeneratorByShape(board, originElement.shape);
8395
+ const temporaryShapePoints = originElement.points.map((point) => moveXOfPoint(point, PREVIEW_ARROW_LINE_DISTANCE +
8396
+ getXDistanceBetweenPoint(originElement.points[0], originElement.points[1], isHorizontalDirection(arrowLineDirection)), arrowLineDirection));
8397
+ temporaryArrowLineG = createG();
8398
+ temporaryShapeG = createG();
8399
+ temporaryArrowLineG.style.opacity = '0.6';
8400
+ temporaryShapeG.style.opacity = '0.6';
8401
+ temporaryShapeElement = createDefaultGeometry(board, temporaryShapePoints, originElement.shape);
8402
+ temporaryShapeElement.angle = originElement.angle;
8403
+ temporaryShapeElement.fill = originElement.fill;
8404
+ temporaryShapeElement.strokeColor = originElement.strokeColor;
8405
+ temporaryShapeElement.strokeStyle = originElement.strokeStyle;
8406
+ temporaryShapeElement.strokeWidth = originElement.strokeWidth;
8407
+ temporaryShapeElement.groupId = originElement.groupId;
8408
+ const rotatedArrowLineStartPoint = rotatePointsByElement(arrowLineStartPoint, originElement) || arrowLineStartPoint;
8409
+ const rotatedArrowLineEndPoint = rotatePointsByElement(arrowLineEndPoint, temporaryShapeElement) || arrowLineEndPoint;
8410
+ temporaryArrowLineElement = handleArrowLineCreating(board, ArrowLineShape.elbow, rotatedArrowLineStartPoint, rotatedArrowLineEndPoint, originElement, temporaryArrowLineG);
8411
+ BOARD_TO_PRE_COMMIT.set(board, { temporaryArrowLineElement, temporaryShapeElement });
8412
+ const connectionInfo = getHitConnection(board, rotatedArrowLineEndPoint, temporaryShapeElement);
8413
+ temporaryArrowLineElement.target.boundId = temporaryShapeElement.id;
8414
+ temporaryArrowLineElement.target.connection = connectionInfo;
8415
+ geometryGenerator.processDrawing(temporaryShapeElement, temporaryShapeG);
8416
+ PlaitBoard.getElementTopHost(board).append(temporaryShapeG);
8417
+ }
8418
+ return;
8419
+ }
8420
+ }
8421
+ BOARD_TO_PRE_COMMIT.delete(board);
8422
+ pointerMove(event);
8423
+ };
8424
+ board.pointerLeave = (pointer) => {
8425
+ clearRef();
8426
+ pointerLeave(pointer);
8427
+ };
8428
+ const clearRef = () => {
8429
+ if (reactionG) {
8430
+ reactionG?.remove();
8431
+ PlaitBoard.getBoardContainer(board).classList.remove(CursorClass.crosshair);
8432
+ temporaryArrowLineG?.remove();
8433
+ temporaryShapeG?.remove();
8434
+ }
8435
+ if (BOARD_TO_PRE_COMMIT.get(board)) {
8436
+ BOARD_TO_PRE_COMMIT.delete(board);
8437
+ }
8438
+ };
8439
+ board.globalPointerUp = (event) => {
8440
+ globalPointerUp(event);
8441
+ clearRef();
8442
+ };
8443
+ return board;
8444
+ };
8445
+
8372
8446
  const withArrowLineTextMove = (board) => {
8373
8447
  let textIndex = 0;
8374
8448
  const movableBuffer = 100;
@@ -8940,9 +9014,9 @@ const withSwimlaneCreateByDrag = (board) => {
8940
9014
  swimlaneG?.remove();
8941
9015
  swimlaneG = createG();
8942
9016
  const tableGenerator = new TableGenerator(board);
9017
+ const pointer = PlaitBoard.getPointer(board);
8943
9018
  const dragMode = isSwimlaneDndMode(board);
8944
9019
  const movingPoint = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
8945
- const pointer = PlaitBoard.getPointer(board);
8946
9020
  if (dragMode) {
8947
9021
  const points = getDefaultSwimlanePoints(pointer, movingPoint);
8948
9022
  temporaryElement = createDefaultSwimlane(pointer, points);
@@ -9316,5 +9390,5 @@ const withDraw = (board) => {
9316
9390
  * Generated bundle index. Do not edit.
9317
9391
  */
9318
9392
 
9319
- export { 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, DefaultLineStyle, DefaultManualInputProperty, DefaultMergeProperty, DefaultMultiDocumentProperty, DefaultNoteProperty, DefaultObjectProperty, DefaultPackageProperty, DefaultPentagonArrowProperty, DefaultPortProperty, DefaultProvidedInterfaceProperty, DefaultRequiredInterfaceProperty, DefaultSwimlaneHorizontalProperty, DefaultSwimlaneHorizontalWithHeaderProperty, DefaultSwimlanePropertyMap, DefaultSwimlaneVerticalProperty, DefaultSwimlaneVerticalWithHeaderProperty, DefaultTextProperty, DefaultTwoWayArrowProperty, DefaultUMLPropertyMap, DrawI18nKey, DrawThemeColors, DrawTransforms, FlowchartSymbols, GEOMETRY_NOT_CLOSED, GEOMETRY_WITHOUT_TEXT, GEOMETRY_WITH_MULTIPLE_TEXT, GeometryCommonTextKeys, GeometryComponent, GeometryShapeGenerator, GeometryThreshold, KEY_TO_TEXT_MANAGE, LINE_ALIGN_TOLERANCE, LINE_AUTO_COMPLETE_DIAMETER, LINE_AUTO_COMPLETE_HOVERED_DIAMETER, LINE_AUTO_COMPLETE_HOVERED_OPACITY, LINE_AUTO_COMPLETE_OPACITY, LINE_HIT_GEOMETRY_BUFFER, LINE_SNAPPING_BUFFER, LINE_SNAPPING_CONNECTOR_BUFFER, LINE_TEXT, LINE_TEXT_SPACE, LineActiveGenerator, MIN_TEXT_WIDTH, MemorizeKey, MultipleTextGeometryTextKeys, PlaitArrowLine, PlaitDrawElement, PlaitGeometry, PlaitTableElement, Q2C, SELECTED_CELLS, SWIMLANE_HEADER_SIZE, ShapeDefaultSpace, SingleTextGenerator, SwimlaneDrawSymbols, SwimlaneSymbols, TableGenerator, TableSymbols, TextGenerator, UMLSymbols, VectorLineComponent, VectorLinePointerType, VectorLineShape, WithArrowLineAutoCompletePluginKey, WithDrawPluginKey, adjustSwimlaneShape, alignElbowSegment, alignPoints, buildClipboardData, buildDefaultTextsByShape, buildSwimlaneTable, clearSelectedCells, collectArrowLineUpdatedRefsByGeometry, createArrowLineElement, createCell, createDefaultCells, createDefaultGeometry, createDefaultRowsOrColumns, createDefaultSwimlane, createGeometryElement, createGeometryElementWithText, createGeometryElementWithoutText, createMultipleTextGeometryElement, createTextElement, createUMLClassOrInterfaceGeometryElement, createVectorLineElement, debugGenerator$1 as debugGenerator, deleteTextManage, drawArrowLine, drawArrowLineArrow, drawBoundReaction, drawGeometry, drawShape, drawVectorLine, editCell, editText, getArrowLineHandleRefPair, getArrowLinePointers, getArrowLinePoints, getArrowLineTextRectangle, getArrowLines, getAutoCompletePoints, getBasicPointers, getCellWithPoints, getCellsRectangle, getCellsWithPoints, getCenterPointsOnPolygon, getConnectionPoint, getCurvePoints, getDefaultBasicShapeProperty, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultGeometryText, getDefaultSwimlanePoints, getDefaultTextPoints, getDefaultUMLProperty, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFirstFilledDrawElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryAlign, getGeometryPointers, getHitCell, getHitConnection, getHitConnectionFromConnectionPoint, getHitConnectorPoint, getHitDrawElement, getHitIndexOfAutoCompletePoint, getHitMultipleGeometryText, getHitShape, getIndexAndDeleteCountByKeyPoint, getLineMemorizedLatest, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getMultipleTextGeometryTextKeys, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedArrowLineElements, getSelectedCells, getSelectedCustomGeometryElements, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedSwimlane, getSelectedTableCellsEditor, getSelectedTableElements, getSelectedVectorLineElements, getSnapResizingRef, getSnapResizingRefOptions, getSnappingRef, getSnappingShape, getSolidElements, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getSwimlaneCount, getSwimlanePointers, getTextKey, getTextManage, getTextManageByCell, getTextRectangle, getTextShapeProperty, getUMLPointers, getVectorByConnection, getVectorLinePointers, getVectorLinePoints, handleArrowLineCreating, hasIllegalElbowPoint, insertClipboardData, insertElement, isCellIncludeText, isClosedCustomGeometry, isClosedDrawElement, isClosedPoints, isDrawElementIncludeText, isDrawElementsIncludeText, isEmptyTextElement, isFilledDrawElement, isGeometryClosed, isGeometryIncludeText, isHitArrowLine, isHitArrowLineText, isHitDrawElement, isHitEdgeOfShape, isHitElementInside, isHitElementText, isHitPolyLine, isHitVectorLine, isInsideOfShape, isMultipleTextGeometry, isMultipleTextShape, isRectangleHitDrawElement, isRectangleHitElementText, isRectangleHitRotatedElement, isRectangleHitRotatedPoints, isSelfLoop, isSingleSelectLine, isSingleSelectSwimlane, isSingleSelectTable, isSingleTextGeometry, isSingleTextShape, isSwimlanePointers, isSwimlaneWithHeader, isTextExceedingBounds, isUpdatedHandleIndex, isUseDefaultOrthogonalRoute, memorizeLatestShape, memorizeLatestText, setSelectedCells, setTextManage, traverseDrawShapes, updateCellIds, updateCellIdsByRowOrColumn, updateColumns, updateRowOrColumnIds, updateRows, vectorLineCreating, withArrowLineAutoComplete, withDraw };
9393
+ export { ArrowLineAutoCompleteGenerator, ArrowLineComponent, ArrowLineHandleKey, ArrowLineMarkerType, ArrowLineShape, BOARD_TO_PRE_COMMIT, 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, DefaultLineStyle, DefaultManualInputProperty, DefaultMergeProperty, DefaultMultiDocumentProperty, DefaultNoteProperty, DefaultObjectProperty, DefaultPackageProperty, DefaultPentagonArrowProperty, DefaultPortProperty, DefaultProvidedInterfaceProperty, DefaultRequiredInterfaceProperty, DefaultSwimlaneHorizontalProperty, DefaultSwimlaneHorizontalWithHeaderProperty, DefaultSwimlanePropertyMap, DefaultSwimlaneVerticalProperty, DefaultSwimlaneVerticalWithHeaderProperty, DefaultTextProperty, DefaultTwoWayArrowProperty, DefaultUMLPropertyMap, DrawI18nKey, DrawThemeColors, DrawTransforms, FlowchartSymbols, GEOMETRY_NOT_CLOSED, GEOMETRY_WITHOUT_TEXT, GEOMETRY_WITH_MULTIPLE_TEXT, GeometryCommonTextKeys, GeometryComponent, GeometryShapeGenerator, GeometryThreshold, KEY_TO_TEXT_MANAGE, LINE_ALIGN_TOLERANCE, LINE_AUTO_COMPLETE_DIAMETER, LINE_AUTO_COMPLETE_HOVERED_DIAMETER, LINE_AUTO_COMPLETE_HOVERED_OPACITY, LINE_AUTO_COMPLETE_OPACITY, LINE_HIT_GEOMETRY_BUFFER, LINE_SNAPPING_BUFFER, LINE_SNAPPING_CONNECTOR_BUFFER, LINE_TEXT, LINE_TEXT_SPACE, LineActiveGenerator, MIN_TEXT_WIDTH, MemorizeKey, MultipleTextGeometryTextKeys, PlaitArrowLine, PlaitDrawElement, PlaitGeometry, PlaitTableElement, Q2C, SELECTED_CELLS, SWIMLANE_HEADER_SIZE, ShapeDefaultSpace, SingleTextGenerator, SwimlaneDrawSymbols, SwimlaneSymbols, TableGenerator, TableSymbols, TextGenerator, UMLSymbols, VectorLineComponent, VectorLinePointerType, VectorLineShape, WithArrowLineAutoCompletePluginKey, WithDrawPluginKey, adjustSwimlaneShape, alignElbowSegment, alignPoints, buildClipboardData, buildDefaultTextsByShape, buildSwimlaneTable, clearSelectedCells, collectArrowLineUpdatedRefsByGeometry, createArrowLineElement, createCell, createDefaultCells, createDefaultGeometry, createDefaultRowsOrColumns, createDefaultSwimlane, createGeometryElement, createGeometryElementWithText, createGeometryElementWithoutText, createMultipleTextGeometryElement, createTextElement, createUMLClassOrInterfaceGeometryElement, createVectorLineElement, debugGenerator$1 as debugGenerator, deleteTextManage, drawArrowLine, drawArrowLineArrow, drawBoundReaction, drawGeometry, drawShape, drawVectorLine, editCell, editText, getArrowLineHandleRefPair, getArrowLinePointers, getArrowLinePoints, getArrowLineTextRectangle, getArrowLines, getAutoCompletePoints, getBasicPointers, getCellWithPoints, getCellsRectangle, getCellsWithPoints, getCenterPointsOnPolygon, getConnectionPoint, getCurvePoints, getDefaultBasicShapeProperty, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultGeometryText, getDefaultSwimlanePoints, getDefaultTextPoints, getDefaultUMLProperty, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFirstFilledDrawElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryAlign, getGeometryPointers, getHitCell, getHitConnection, getHitConnectionFromConnectionPoint, getHitConnectorPoint, getHitDrawElement, getHitIndexOfAutoCompletePoint, getHitMultipleGeometryText, getHitShape, getIndexAndDeleteCountByKeyPoint, getLineMemorizedLatest, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getMultipleTextGeometryTextKeys, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedArrowLineElements, getSelectedCells, getSelectedCustomGeometryElements, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedSwimlane, getSelectedTableCellsEditor, getSelectedTableElements, getSelectedVectorLineElements, getSnapResizingRef, getSnapResizingRefOptions, getSnappingRef, getSnappingShape, getSolidElements, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getSwimlaneCount, getSwimlanePointers, getSwimlaneShapes, getTextKey, getTextManage, getTextManageByCell, getTextRectangle, getTextShapeProperty, getUMLPointers, getVectorByConnection, getVectorLinePointers, getVectorLinePoints, handleArrowLineCreating, hasIllegalElbowPoint, insertClipboardData, insertElement, isCellIncludeText, isClosedCustomGeometry, isClosedDrawElement, isClosedPoints, isDrawElementIncludeText, isDrawElementsIncludeText, isEmptyTextElement, isFilledDrawElement, isGeometryClosed, isGeometryIncludeText, isHitArrowLine, isHitArrowLineText, isHitDrawElement, isHitEdgeOfShape, isHitElementInside, isHitElementText, isHitPolyLine, isHitVectorLine, isInsideOfShape, isMultipleTextGeometry, isMultipleTextShape, isRectangleHitDrawElement, isRectangleHitElementText, isRectangleHitRotatedElement, isRectangleHitRotatedPoints, isSelfLoop, isSingleSelectLine, isSingleSelectSwimlane, isSingleSelectTable, isSingleTextGeometry, isSingleTextShape, isSwimlanePointers, isSwimlaneShape, isSwimlaneWithHeader, isTextExceedingBounds, isUpdatedHandleIndex, isUseDefaultOrthogonalRoute, memorizeLatestShape, memorizeLatestText, setSelectedCells, setTextManage, traverseDrawShapes, updateCellIds, updateCellIdsByRowOrColumn, updateColumns, updateRowOrColumnIds, updateRows, vectorLineCreating, withArrowLineAutoComplete, withDraw };
9320
9394
  //# sourceMappingURL=plait-draw.mjs.map