@plait/draw 0.82.0-next.0 → 0.83.0

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.
@@ -4,8 +4,8 @@ export declare const DefaultLineStyle: {
4
4
  };
5
5
  export declare const LINE_TEXT_SPACE = 4;
6
6
  export declare const LINE_AUTO_COMPLETE_DIAMETER = 6;
7
- export declare const LINE_AUTO_COMPLETE_OPACITY = 0.6;
8
- export declare const LINE_AUTO_COMPLETE_HOVERED_OPACITY = 0.8;
9
- export declare const LINE_AUTO_COMPLETE_HOVERED_DIAMETER = 10;
7
+ export declare const LINE_AUTO_COMPLETE_OPACITY = 1;
8
+ export declare const LINE_AUTO_COMPLETE_HOVERED_OPACITY = 1;
9
+ export declare const LINE_AUTO_COMPLETE_HOVERED_DIAMETER = 12;
10
10
  export declare const LINE_ALIGN_TOLERANCE = 3;
11
11
  export declare const LINE_TEXT = "\u6587\u672C";
@@ -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, 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, 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, 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, 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';
@@ -472,9 +472,9 @@ const DefaultLineStyle = {
472
472
  };
473
473
  const LINE_TEXT_SPACE = 4;
474
474
  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;
475
+ const LINE_AUTO_COMPLETE_OPACITY = 1;
476
+ const LINE_AUTO_COMPLETE_HOVERED_OPACITY = 1;
477
+ const LINE_AUTO_COMPLETE_HOVERED_DIAMETER = 12;
478
478
  const LINE_ALIGN_TOLERANCE = 3;
479
479
  const LINE_TEXT = '文本';
480
480
 
@@ -1486,7 +1486,7 @@ const Q2C = (points) => {
1486
1486
  }
1487
1487
  return result;
1488
1488
  };
1489
- const handleArrowLineCreating = (board, lineShape, sourcePoint, movingPoint, sourceElement, lineShapeG) => {
1489
+ const handleArrowLineCreating = (board, lineShape, sourcePoint, movingPoint, sourceElement, lineShapeG, options) => {
1490
1490
  const hitElement = getSnappingShape(board, movingPoint);
1491
1491
  const targetConnection = hitElement ? getHitConnection(board, movingPoint, hitElement) : undefined;
1492
1492
  const sourceConnection = sourceElement ? getHitConnection(board, sourcePoint, sourceElement) : undefined;
@@ -1500,7 +1500,8 @@ const handleArrowLineCreating = (board, lineShape, sourcePoint, movingPoint, sou
1500
1500
  targetMarker && delete memorizedLatest.target;
1501
1501
  const temporaryLineElement = createArrowLineElement(lineShape, [sourcePoint, movingPoint], { marker: sourceMarker || ArrowLineMarkerType.none, connection: sourceConnection, boundId: sourceElement?.id }, { marker: targetMarker || ArrowLineMarkerType.arrow, connection: targetConnection, boundId: targetBoundId }, [], {
1502
1502
  strokeWidth: DefaultLineStyle.strokeWidth,
1503
- ...memorizedLatest
1503
+ ...memorizedLatest,
1504
+ ...options
1504
1505
  });
1505
1506
  const linePoints = getArrowLinePoints(board, temporaryLineElement);
1506
1507
  const otherPoint = linePoints[0];
@@ -2421,7 +2422,7 @@ const getFlowchartDefaultFill = (theme) => {
2421
2422
  };
2422
2423
  const getTextShapeProperty = (board, text, fontSize) => {
2423
2424
  fontSize = fontSize ? Number(fontSize) : DEFAULT_FONT_SIZE;
2424
- const textSize = measureElement(buildText(text), { fontSize, fontFamily: DEFAULT_FONT_FAMILY });
2425
+ const textSize = measureElement(board, buildText(text), { fontSize, fontFamily: DEFAULT_FONT_FAMILY });
2425
2426
  return {
2426
2427
  width: textSize.width + ShapeDefaultSpace.rectangleAndText * 2,
2427
2428
  height: textSize.height
@@ -7075,7 +7076,7 @@ class ArrowLineAutoCompleteGenerator extends Generator {
7075
7076
  middlePoints.forEach((point, index) => {
7076
7077
  const circle = drawCircle(PlaitBoard.getRoughSVG(this.board), point, LINE_AUTO_COMPLETE_DIAMETER, {
7077
7078
  stroke: 'none',
7078
- fill: RgbaToHEX(PRIMARY_COLOR, LINE_AUTO_COMPLETE_OPACITY),
7079
+ fill: rgbaToHEX(PRIMARY_COLOR, LINE_AUTO_COMPLETE_OPACITY),
7079
7080
  fillStyle: 'solid'
7080
7081
  });
7081
7082
  circle.classList.add(`line-auto-complete-${index}`);
@@ -7957,7 +7958,7 @@ const withArrowLineResize = (board) => {
7957
7958
  const selectedLineElements = getSelectedArrowLineElements(board);
7958
7959
  if (selectedLineElements.length > 0) {
7959
7960
  let result = null;
7960
- selectedLineElements.forEach(value => {
7961
+ selectedLineElements.forEach((value) => {
7961
7962
  const handleRef = getHitLineResizeHandleRef(board, value, point);
7962
7963
  if (handleRef) {
7963
7964
  result = {
@@ -8160,7 +8161,7 @@ const withArrowLineText = (board) => {
8160
8161
  const defaultLineText = getDefaultLineText(board);
8161
8162
  const textMemory = getMemorizedLatest('arrow-line')?.text || {};
8162
8163
  const textElement = buildText(defaultLineText, undefined, textMemory);
8163
- const { width, height } = measureElement(textElement, {
8164
+ const { width, height } = measureElement(board, textElement, {
8164
8165
  fontSize: DEFAULT_FONT_SIZE,
8165
8166
  fontFamily: DEFAULT_FONT_FAMILY
8166
8167
  });
@@ -8263,44 +8264,8 @@ class ImageComponent extends CommonElementFlavour {
8263
8264
  }
8264
8265
  }
8265
8266
 
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
8267
  const WithArrowLineAutoCompletePluginKey = 'plait-arrow-line-auto-complete-plugin-key';
8268
+ const BOARD_TO_PRE_COMMIT = new WeakMap();
8304
8269
  const withArrowLineAutoComplete = (board) => {
8305
8270
  const { pointerDown, pointerMove, globalPointerUp } = board;
8306
8271
  let autoCompletePoint = null;
@@ -8331,7 +8296,7 @@ const withArrowLineAutoComplete = (board) => {
8331
8296
  let movingPoint = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
8332
8297
  if (autoCompletePoint && sourceElement) {
8333
8298
  const distance = distanceBetweenPointAndPoint(...(rotateAntiPointsByElement(board, movingPoint, sourceElement) || movingPoint), ...autoCompletePoint);
8334
- if (distance > PRESS_AND_MOVE_BUFFER) {
8299
+ if (distance > PRESS_AND_MOVE_BUFFER * 2) {
8335
8300
  const rectangle = RectangleClient.getRectangleByPoints(sourceElement.points);
8336
8301
  const shape = getElementShape(sourceElement);
8337
8302
  const engine = getEngine(shape);
@@ -8356,6 +8321,14 @@ const withArrowLineAutoComplete = (board) => {
8356
8321
  const afterComplete = board.getPluginOptions(WithArrowLineAutoCompletePluginKey)?.afterComplete;
8357
8322
  afterComplete && afterComplete(temporaryElement);
8358
8323
  }
8324
+ else {
8325
+ const preCommitRef = BOARD_TO_PRE_COMMIT.get(board);
8326
+ if (preCommitRef) {
8327
+ Transforms.insertNode(board, preCommitRef.temporaryArrowLineElement, [board.children.length]);
8328
+ insertElement(board, preCommitRef.temporaryShapeElement);
8329
+ BOARD_TO_PRE_COMMIT.delete(board);
8330
+ }
8331
+ }
8359
8332
  if (autoCompletePoint) {
8360
8333
  BoardTransforms.updatePointerType(board, PlaitPointerType.selection);
8361
8334
  autoCompletePoint = null;
@@ -8369,6 +8342,96 @@ const withArrowLineAutoComplete = (board) => {
8369
8342
  return board;
8370
8343
  };
8371
8344
 
8345
+ const PREVIEW_ARROW_LINE_DISTANCE = 100;
8346
+ const withArrowLineAutoCompleteReaction = (board) => {
8347
+ const { pointerMove, pointerLeave, globalPointerUp } = board;
8348
+ let reactionG = null;
8349
+ let temporaryArrowLineElement = null;
8350
+ let temporaryShapeElement = null;
8351
+ let temporaryArrowLineG = null;
8352
+ let temporaryShapeG = null;
8353
+ board.pointerMove = (event) => {
8354
+ reactionG?.remove();
8355
+ PlaitBoard.getBoardContainer(board).classList.remove(CursorClass.crosshair);
8356
+ const selectedElements = getSelectedDrawElements(board);
8357
+ temporaryArrowLineG?.remove();
8358
+ temporaryShapeG?.remove();
8359
+ const originElement = selectedElements.length === 1 && selectedElements[0];
8360
+ const activePoint = toActivePoint(board, event.x, event.y);
8361
+ if (!PlaitBoard.isReadonly(board) && !isSelectionMoving(board) && originElement && PlaitDrawElement.isShapeElement(originElement)) {
8362
+ const points = getAutoCompletePoints(board, originElement, true);
8363
+ const hitIndex = getHitIndexOfAutoCompletePoint(rotateAntiPointsByElement(board, activePoint, originElement, true) || activePoint, points);
8364
+ const hitPoint = points[hitIndex];
8365
+ const ref = PlaitElement.getElementRef(originElement);
8366
+ const lineAutoCompleteGenerator = ref.getGenerator(ArrowLineAutoCompleteGenerator.key);
8367
+ lineAutoCompleteGenerator.recoverAutoCompleteG();
8368
+ if (hitPoint) {
8369
+ reactionG = drawCircle(PlaitBoard.getRoughSVG(board), hitPoint, LINE_AUTO_COMPLETE_HOVERED_DIAMETER, {
8370
+ stroke: 'none',
8371
+ fill: rgbaToHEX(PRIMARY_COLOR, LINE_AUTO_COMPLETE_HOVERED_OPACITY),
8372
+ fillStyle: 'solid'
8373
+ });
8374
+ const originRect = RectangleClient.getRectangleByPoints(originElement.points);
8375
+ let arrowLineStartPoint = RectangleClient.getEdgeCenterPoints(originRect)[hitIndex];
8376
+ const arrowLineDirection = getDirectionByIndex(hitIndex);
8377
+ let arrowLineEndPoint = moveXOfPoint(arrowLineStartPoint, PREVIEW_ARROW_LINE_DISTANCE, arrowLineDirection);
8378
+ const pointer = PlaitBoard.getPointer(board);
8379
+ const geometryGenerator = getGeometryGeneratorByShape(board, pointer);
8380
+ const temporaryShapePoints = originElement.points.map((point) => moveXOfPoint(point, PREVIEW_ARROW_LINE_DISTANCE +
8381
+ getXDistanceBetweenPoint(originElement.points[0], originElement.points[1], isHorizontalDirection(arrowLineDirection)), arrowLineDirection));
8382
+ temporaryArrowLineG = createG();
8383
+ temporaryShapeG = createG();
8384
+ temporaryArrowLineG.style.opacity = '0.6';
8385
+ temporaryShapeG.style.opacity = '0.6';
8386
+ temporaryShapeElement = {
8387
+ ...originElement,
8388
+ points: temporaryShapePoints,
8389
+ id: idCreator()
8390
+ };
8391
+ const rotatedArrowLineStartPoint = rotatePointsByElement(arrowLineStartPoint, originElement) || arrowLineStartPoint;
8392
+ const rotatedArrowLineEndPoint = rotatePointsByElement(arrowLineEndPoint, temporaryShapeElement) || arrowLineEndPoint;
8393
+ temporaryArrowLineElement = handleArrowLineCreating(board, ArrowLineShape.elbow, rotatedArrowLineStartPoint, rotatedArrowLineEndPoint, originElement, temporaryArrowLineG);
8394
+ BOARD_TO_PRE_COMMIT.set(board, { temporaryArrowLineElement, temporaryShapeElement });
8395
+ const connectionInfo = getHitConnection(board, rotatedArrowLineEndPoint, temporaryShapeElement);
8396
+ temporaryArrowLineElement.target.boundId = temporaryShapeElement.id;
8397
+ temporaryArrowLineElement.target.connection = connectionInfo;
8398
+ geometryGenerator.processDrawing(temporaryShapeElement, temporaryShapeG);
8399
+ PlaitBoard.getElementTopHost(board).append(temporaryShapeG);
8400
+ PlaitBoard.getActiveHost(board).append(reactionG);
8401
+ PlaitBoard.getBoardContainer(board).classList.add(CursorClass.crosshair);
8402
+ if (hasValidAngle(originElement)) {
8403
+ const rectangle = board.getRectangle(originElement);
8404
+ const activeRectangle = toActiveRectangleFromViewBoxRectangle(board, rectangle);
8405
+ setAngleForG(reactionG, RectangleClient.getCenterPoint(activeRectangle), originElement.angle);
8406
+ }
8407
+ return;
8408
+ }
8409
+ }
8410
+ BOARD_TO_PRE_COMMIT.delete(board);
8411
+ pointerMove(event);
8412
+ };
8413
+ board.pointerLeave = (pointer) => {
8414
+ clearRef();
8415
+ pointerLeave(pointer);
8416
+ };
8417
+ const clearRef = () => {
8418
+ if (reactionG) {
8419
+ reactionG?.remove();
8420
+ PlaitBoard.getBoardContainer(board).classList.remove(CursorClass.crosshair);
8421
+ temporaryArrowLineG?.remove();
8422
+ temporaryShapeG?.remove();
8423
+ }
8424
+ if (BOARD_TO_PRE_COMMIT.get(board)) {
8425
+ BOARD_TO_PRE_COMMIT.delete(board);
8426
+ }
8427
+ };
8428
+ board.globalPointerUp = (event) => {
8429
+ globalPointerUp(event);
8430
+ clearRef();
8431
+ };
8432
+ return board;
8433
+ };
8434
+
8372
8435
  const withArrowLineTextMove = (board) => {
8373
8436
  let textIndex = 0;
8374
8437
  const movableBuffer = 100;
@@ -9250,8 +9313,8 @@ const withDraw = (board) => {
9250
9313
  }
9251
9314
  return isHit(element, point, isStrict);
9252
9315
  };
9253
- board.getOneHitElement = elements => {
9254
- const isAllDrawElements = elements.every(item => PlaitDrawElement.isDrawElement(item));
9316
+ board.getOneHitElement = (elements) => {
9317
+ const isAllDrawElements = elements.every((item) => PlaitDrawElement.isDrawElement(item));
9255
9318
  if (isAllDrawElements) {
9256
9319
  return getHitDrawElement(board, elements);
9257
9320
  }
@@ -9277,7 +9340,7 @@ const withDraw = (board) => {
9277
9340
  if (PlaitDrawElement.isArrowLine(element)) {
9278
9341
  const selectedElements = getSelectedElements(board);
9279
9342
  const isSelected = (boundId) => {
9280
- return !!selectedElements.find(value => value.id === boundId);
9343
+ return !!selectedElements.find((value) => value.id === boundId);
9281
9344
  };
9282
9345
  if (!element.source.boundId && !element.target.boundId) {
9283
9346
  return true;
@@ -9300,10 +9363,10 @@ const withDraw = (board) => {
9300
9363
  };
9301
9364
  board.getRelatedFragment = (elements, originData) => {
9302
9365
  const selectedElements = originData?.length ? originData : getSelectedElements(board);
9303
- const lineElements = board.children.filter(element => PlaitDrawElement.isArrowLine(element));
9304
- const activeLines = lineElements.filter(line => {
9305
- const source = selectedElements.find(element => element.id === line.source.boundId);
9306
- const target = selectedElements.find(element => element.id === line.target.boundId);
9366
+ const lineElements = board.children.filter((element) => PlaitDrawElement.isArrowLine(element));
9367
+ const activeLines = lineElements.filter((line) => {
9368
+ const source = selectedElements.find((element) => element.id === line.source.boundId);
9369
+ const target = selectedElements.find((element) => element.id === line.target.boundId);
9307
9370
  const isSelected = selectedElements.includes(line);
9308
9371
  return source && target && !isSelected;
9309
9372
  });
@@ -9316,5 +9379,5 @@ const withDraw = (board) => {
9316
9379
  * Generated bundle index. Do not edit.
9317
9380
  */
9318
9381
 
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 };
9382
+ 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, 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 };
9320
9383
  //# sourceMappingURL=plait-draw.mjs.map