@excalidraw/element 0.18.0-3bdaafe → 0.18.0-4e0441e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/dev/index.js +317 -216
  2. package/dist/dev/index.js.map +3 -3
  3. package/dist/prod/index.js +11 -11
  4. package/dist/types/common/src/constants.d.ts +21 -4
  5. package/dist/types/common/src/utils.d.ts +3 -1
  6. package/dist/types/element/src/renderElement.d.ts +4 -1
  7. package/dist/types/element/src/transformHandles.d.ts +1 -1
  8. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +21 -6
  9. package/dist/types/excalidraw/actions/actionBoundText.d.ts +14 -4
  10. package/dist/types/excalidraw/actions/actionCanvas.d.ts +92 -40
  11. package/dist/types/excalidraw/actions/actionClipboard.d.ts +42 -12
  12. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +7 -2
  13. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +21 -6
  14. package/dist/types/excalidraw/actions/actionElementLink.d.ts +7 -2
  15. package/dist/types/excalidraw/actions/actionElementLock.d.ts +14 -4
  16. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +7 -2
  17. package/dist/types/excalidraw/actions/actionExport.d.ts +63 -18
  18. package/dist/types/excalidraw/actions/actionFinalize.d.ts +14 -4
  19. package/dist/types/excalidraw/actions/actionFrame.d.ts +28 -8
  20. package/dist/types/excalidraw/actions/actionGroup.d.ts +14 -4
  21. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +8 -3
  22. package/dist/types/excalidraw/actions/actionLink.d.ts +6 -1
  23. package/dist/types/excalidraw/actions/actionMenu.d.ts +7 -368
  24. package/dist/types/excalidraw/actions/actionNavigate.d.ts +14 -4
  25. package/dist/types/excalidraw/actions/actionProperties.d.ts +122 -38
  26. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +7 -2
  27. package/dist/types/excalidraw/actions/actionStyles.d.ts +7 -2
  28. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +7 -2
  29. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +7 -2
  30. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +7 -2
  31. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +7 -2
  32. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +7 -2
  33. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +7 -2
  34. package/dist/types/excalidraw/actions/index.d.ts +2 -2
  35. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  36. package/dist/types/excalidraw/appState.d.ts +5 -1
  37. package/dist/types/excalidraw/clipboard.d.ts +63 -1
  38. package/dist/types/excalidraw/components/Actions.d.ts +17 -3
  39. package/dist/types/excalidraw/components/App.d.ts +1 -2
  40. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +1 -0
  41. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
  42. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
  43. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
  44. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  45. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  46. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  47. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  48. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  49. package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
  50. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  51. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
  52. package/dist/types/excalidraw/components/MobileToolBar.d.ts +11 -0
  53. package/dist/types/excalidraw/components/Popover.d.ts +2 -1
  54. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  55. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
  56. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  57. package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
  58. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
  59. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
  60. package/dist/types/excalidraw/components/icons.d.ts +5 -0
  61. package/dist/types/excalidraw/data/blob.d.ts +2 -9
  62. package/dist/types/excalidraw/data/types.d.ts +4 -1
  63. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  64. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  65. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  66. package/dist/types/excalidraw/types.d.ts +10 -3
  67. package/dist/types/math/src/segment.d.ts +1 -0
  68. package/package.json +3 -3
package/dist/dev/index.js CHANGED
@@ -2261,17 +2261,17 @@ var rough_default = {
2261
2261
  // src/bounds.ts
2262
2262
  import {
2263
2263
  arrayToMap as arrayToMap6,
2264
- invariant as invariant7,
2264
+ invariant as invariant8,
2265
2265
  rescalePoints,
2266
2266
  sizeOf
2267
2267
  } from "@excalidraw/common";
2268
2268
  import {
2269
2269
  degreesToRadians,
2270
- lineSegment as lineSegment5,
2270
+ lineSegment as lineSegment6,
2271
2271
  pointDistance as pointDistance7,
2272
- pointFrom as pointFrom13,
2272
+ pointFrom as pointFrom14,
2273
2273
  pointFromArray as pointFromArray3,
2274
- pointRotateRads as pointRotateRads11
2274
+ pointRotateRads as pointRotateRads12
2275
2275
  } from "@excalidraw/math";
2276
2276
 
2277
2277
  // ../utils/src/shape.ts
@@ -2448,9 +2448,9 @@ var getClosedCurveShape = (element, roughShape, startingPoint = pointFrom(0, 0),
2448
2448
  // src/shape.ts
2449
2449
  init_define_import_meta_env();
2450
2450
  import {
2451
- pointFrom as pointFrom12,
2451
+ pointFrom as pointFrom13,
2452
2452
  pointDistance as pointDistance6,
2453
- pointRotateRads as pointRotateRads10
2453
+ pointRotateRads as pointRotateRads11
2454
2454
  } from "@excalidraw/math";
2455
2455
  import {
2456
2456
  ROUGHNESS,
@@ -2627,7 +2627,12 @@ function ae(e, t = {}) {
2627
2627
  }
2628
2628
 
2629
2629
  // src/renderElement.ts
2630
- import { isRightAngleRads } from "@excalidraw/math";
2630
+ import {
2631
+ isRightAngleRads,
2632
+ lineSegment as lineSegment5,
2633
+ pointFrom as pointFrom12,
2634
+ pointRotateRads as pointRotateRads10
2635
+ } from "@excalidraw/math";
2631
2636
  import {
2632
2637
  BOUND_TEXT_PADDING as BOUND_TEXT_PADDING3,
2633
2638
  DEFAULT_REDUCED_GLOBAL_ALPHA,
@@ -2638,7 +2643,8 @@ import {
2638
2643
  distance as distance2,
2639
2644
  getFontString as getFontString3,
2640
2645
  isRTL,
2641
- getVerticalOffset
2646
+ getVerticalOffset,
2647
+ invariant as invariant7
2642
2648
  } from "@excalidraw/common";
2643
2649
 
2644
2650
  // src/cropElement.ts
@@ -7270,6 +7276,28 @@ var bindPointToSnapToElementOutline = (arrow, bindableElement, startOrEnd, eleme
7270
7276
  intersector,
7271
7277
  FIXED_BINDING_DISTANCE
7272
7278
  ).sort(pointDistanceSq)[0];
7279
+ if (!intersection) {
7280
+ const anotherPoint = pointFrom8(
7281
+ !isHorizontal ? center[0] : snapPoint[0],
7282
+ isHorizontal ? center[1] : snapPoint[1]
7283
+ );
7284
+ const anotherIntersector = lineSegment4(
7285
+ anotherPoint,
7286
+ pointFromVector5(
7287
+ vectorScale6(
7288
+ vectorNormalize3(vectorFromPoint6(snapPoint, anotherPoint)),
7289
+ Math.max(bindableElement.width, bindableElement.height) * 2
7290
+ ),
7291
+ anotherPoint
7292
+ )
7293
+ );
7294
+ intersection = intersectElementWithLineSegment(
7295
+ bindableElement,
7296
+ elementsMap,
7297
+ anotherIntersector,
7298
+ FIXED_BINDING_DISTANCE
7299
+ ).sort(pointDistanceSq)[0];
7300
+ }
7273
7301
  } else {
7274
7302
  intersection = intersectElementWithLineSegment(
7275
7303
  bindableElement,
@@ -11191,6 +11219,58 @@ function getFreeDrawPath2D(element) {
11191
11219
  return pathsCache.get(element);
11192
11220
  }
11193
11221
  function getFreeDrawSvgPath(element) {
11222
+ return getSvgPathFromStroke(getFreedrawOutlinePoints(element));
11223
+ }
11224
+ function getFreedrawOutlineAsSegments(element, points, elementsMap) {
11225
+ const bounds = getElementBounds(
11226
+ {
11227
+ ...element,
11228
+ angle: 0
11229
+ },
11230
+ elementsMap
11231
+ );
11232
+ const center = pointFrom12(
11233
+ (bounds[0] + bounds[2]) / 2,
11234
+ (bounds[1] + bounds[3]) / 2
11235
+ );
11236
+ invariant7(points.length >= 2, "Freepath outline must have at least 2 points");
11237
+ return points.slice(2).reduce(
11238
+ (acc, curr) => {
11239
+ acc.push(
11240
+ lineSegment5(
11241
+ acc[acc.length - 1][1],
11242
+ pointRotateRads10(
11243
+ pointFrom12(curr[0] + element.x, curr[1] + element.y),
11244
+ center,
11245
+ element.angle
11246
+ )
11247
+ )
11248
+ );
11249
+ return acc;
11250
+ },
11251
+ [
11252
+ lineSegment5(
11253
+ pointRotateRads10(
11254
+ pointFrom12(
11255
+ points[0][0] + element.x,
11256
+ points[0][1] + element.y
11257
+ ),
11258
+ center,
11259
+ element.angle
11260
+ ),
11261
+ pointRotateRads10(
11262
+ pointFrom12(
11263
+ points[1][0] + element.x,
11264
+ points[1][1] + element.y
11265
+ ),
11266
+ center,
11267
+ element.angle
11268
+ )
11269
+ )
11270
+ ]
11271
+ );
11272
+ }
11273
+ function getFreedrawOutlinePoints(element) {
11194
11274
  const inputPoints = element.simulatePressure ? element.points : element.points.length ? element.points.map(([x, y], i) => [x, y, element.pressures[i]]) : [[0, 0, 0.5]];
11195
11275
  const options = {
11196
11276
  simulatePressure: element.simulatePressure,
@@ -11203,7 +11283,7 @@ function getFreeDrawSvgPath(element) {
11203
11283
  last: !!element.lastCommittedPoint
11204
11284
  // LastCommittedPoint is added on pointerup
11205
11285
  };
11206
- return getSvgPathFromStroke(ae(inputPoints, options));
11286
+ return ae(inputPoints, options);
11207
11287
  }
11208
11288
  function med(A2, B2) {
11209
11289
  return [(A2[0] + B2[0]) / 2, (A2[1] + B2[1]) / 2];
@@ -11230,7 +11310,7 @@ function getSvgPathFromStroke(points) {
11230
11310
  // src/comparisons.ts
11231
11311
  init_define_import_meta_env();
11232
11312
  var hasBackground = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "ellipse" || type === "diamond" || type === "line" || type === "freedraw";
11233
- var hasStrokeColor = (type) => type !== "image" && type !== "frame" && type !== "magicframe";
11313
+ var hasStrokeColor = (type) => type === "rectangle" || type === "ellipse" || type === "diamond" || type === "freedraw" || type === "arrow" || type === "line" || type === "text";
11234
11314
  var hasStrokeWidth = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "ellipse" || type === "diamond" || type === "freedraw" || type === "arrow" || type === "line";
11235
11315
  var hasStrokeStyle = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "ellipse" || type === "diamond" || type === "arrow" || type === "line";
11236
11316
  var canChangeRoundness = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "line" || type === "diamond" || type === "image";
@@ -11486,26 +11566,26 @@ var generateLinearCollisionShape = (element) => {
11486
11566
  switch (element.type) {
11487
11567
  case "line":
11488
11568
  case "arrow": {
11489
- const points = element.points.length ? element.points : [pointFrom12(0, 0)];
11569
+ const points = element.points.length ? element.points : [pointFrom13(0, 0)];
11490
11570
  if (isElbowArrow(element)) {
11491
11571
  return generator.path(generateElbowArrowShape(points, 16), options).sets[0].ops;
11492
11572
  } else if (!element.roundness) {
11493
11573
  return points.map((point, idx) => {
11494
- const p = pointRotateRads10(
11495
- pointFrom12(element.x + point[0], element.y + point[1]),
11574
+ const p = pointRotateRads11(
11575
+ pointFrom13(element.x + point[0], element.y + point[1]),
11496
11576
  center,
11497
11577
  element.angle
11498
11578
  );
11499
11579
  return {
11500
11580
  op: idx === 0 ? "move" : "lineTo",
11501
- data: pointFrom12(p[0] - element.x, p[1] - element.y)
11581
+ data: pointFrom13(p[0] - element.x, p[1] - element.y)
11502
11582
  };
11503
11583
  });
11504
11584
  }
11505
11585
  return generator.curve(points, options).sets[0].ops.slice(0, element.points.length).map((op, i) => {
11506
11586
  if (i === 0) {
11507
- const p = pointRotateRads10(
11508
- pointFrom12(
11587
+ const p = pointRotateRads11(
11588
+ pointFrom13(
11509
11589
  element.x + op.data[0],
11510
11590
  element.y + op.data[1]
11511
11591
  ),
@@ -11514,30 +11594,30 @@ var generateLinearCollisionShape = (element) => {
11514
11594
  );
11515
11595
  return {
11516
11596
  op: "move",
11517
- data: pointFrom12(p[0] - element.x, p[1] - element.y)
11597
+ data: pointFrom13(p[0] - element.x, p[1] - element.y)
11518
11598
  };
11519
11599
  }
11520
11600
  return {
11521
11601
  op: "bcurveTo",
11522
11602
  data: [
11523
- pointRotateRads10(
11524
- pointFrom12(
11603
+ pointRotateRads11(
11604
+ pointFrom13(
11525
11605
  element.x + op.data[0],
11526
11606
  element.y + op.data[1]
11527
11607
  ),
11528
11608
  center,
11529
11609
  element.angle
11530
11610
  ),
11531
- pointRotateRads10(
11532
- pointFrom12(
11611
+ pointRotateRads11(
11612
+ pointFrom13(
11533
11613
  element.x + op.data[2],
11534
11614
  element.y + op.data[3]
11535
11615
  ),
11536
11616
  center,
11537
11617
  element.angle
11538
11618
  ),
11539
- pointRotateRads10(
11540
- pointFrom12(
11619
+ pointRotateRads11(
11620
+ pointFrom13(
11541
11621
  element.x + op.data[4],
11542
11622
  element.y + op.data[5]
11543
11623
  ),
@@ -11545,7 +11625,7 @@ var generateLinearCollisionShape = (element) => {
11545
11625
  element.angle
11546
11626
  )
11547
11627
  ].map(
11548
- (p) => pointFrom12(p[0] - element.x, p[1] - element.y)
11628
+ (p) => pointFrom13(p[0] - element.x, p[1] - element.y)
11549
11629
  ).flat()
11550
11630
  };
11551
11631
  });
@@ -11560,8 +11640,8 @@ var generateLinearCollisionShape = (element) => {
11560
11640
  );
11561
11641
  return generator.curve(simplifiedPoints, options).sets[0].ops.slice(0, element.points.length).map((op, i) => {
11562
11642
  if (i === 0) {
11563
- const p = pointRotateRads10(
11564
- pointFrom12(
11643
+ const p = pointRotateRads11(
11644
+ pointFrom13(
11565
11645
  element.x + op.data[0],
11566
11646
  element.y + op.data[1]
11567
11647
  ),
@@ -11570,30 +11650,30 @@ var generateLinearCollisionShape = (element) => {
11570
11650
  );
11571
11651
  return {
11572
11652
  op: "move",
11573
- data: pointFrom12(p[0] - element.x, p[1] - element.y)
11653
+ data: pointFrom13(p[0] - element.x, p[1] - element.y)
11574
11654
  };
11575
11655
  }
11576
11656
  return {
11577
11657
  op: "bcurveTo",
11578
11658
  data: [
11579
- pointRotateRads10(
11580
- pointFrom12(
11659
+ pointRotateRads11(
11660
+ pointFrom13(
11581
11661
  element.x + op.data[0],
11582
11662
  element.y + op.data[1]
11583
11663
  ),
11584
11664
  center,
11585
11665
  element.angle
11586
11666
  ),
11587
- pointRotateRads10(
11588
- pointFrom12(
11667
+ pointRotateRads11(
11668
+ pointFrom13(
11589
11669
  element.x + op.data[2],
11590
11670
  element.y + op.data[3]
11591
11671
  ),
11592
11672
  center,
11593
11673
  element.angle
11594
11674
  ),
11595
- pointRotateRads10(
11596
- pointFrom12(
11675
+ pointRotateRads11(
11676
+ pointFrom13(
11597
11677
  element.x + op.data[4],
11598
11678
  element.y + op.data[5]
11599
11679
  ),
@@ -11601,7 +11681,7 @@ var generateLinearCollisionShape = (element) => {
11601
11681
  element.angle
11602
11682
  )
11603
11683
  ].map(
11604
- (p) => pointFrom12(p[0] - element.x, p[1] - element.y)
11684
+ (p) => pointFrom13(p[0] - element.x, p[1] - element.y)
11605
11685
  ).flat()
11606
11686
  };
11607
11687
  });
@@ -11698,7 +11778,7 @@ var generateElementShape = (element, generator, {
11698
11778
  case "arrow": {
11699
11779
  let shape;
11700
11780
  const options = generateRoughOptions(element);
11701
- const points = element.points.length ? element.points : [pointFrom12(0, 0)];
11781
+ const points = element.points.length ? element.points : [pointFrom13(0, 0)];
11702
11782
  if (isElbowArrow(element)) {
11703
11783
  if (!points.every(
11704
11784
  (point) => Math.abs(point[0]) <= 1e6 && Math.abs(point[1]) <= 1e6
@@ -11860,14 +11940,14 @@ var getElementShape = (element, elementsMap) => {
11860
11940
  return shouldTestInside(element) ? getClosedCurveShape(
11861
11941
  element,
11862
11942
  roughShape,
11863
- pointFrom12(element.x, element.y),
11943
+ pointFrom13(element.x, element.y),
11864
11944
  element.angle,
11865
- pointFrom12(cx, cy)
11945
+ pointFrom13(cx, cy)
11866
11946
  ) : getCurveShape(
11867
11947
  roughShape,
11868
- pointFrom12(element.x, element.y),
11948
+ pointFrom13(element.x, element.y),
11869
11949
  element.angle,
11870
- pointFrom12(cx, cy)
11950
+ pointFrom13(cx, cy)
11871
11951
  );
11872
11952
  }
11873
11953
  case "ellipse":
@@ -11876,7 +11956,7 @@ var getElementShape = (element, elementsMap) => {
11876
11956
  const [, , , , cx, cy] = getElementAbsoluteCoords2(element, elementsMap);
11877
11957
  return getFreedrawShape(
11878
11958
  element,
11879
- pointFrom12(cx, cy),
11959
+ pointFrom13(cx, cy),
11880
11960
  shouldTestInside(element)
11881
11961
  );
11882
11962
  }
@@ -11895,9 +11975,9 @@ var toggleLinePolygonState = (element, nextPolygonState) => {
11895
11975
  firstPoint[1] - lastPoint[1]
11896
11976
  );
11897
11977
  if (distance3 > LINE_POLYGON_POINT_MERGE_DISTANCE || updatedPoints.length < 4) {
11898
- updatedPoints.push(pointFrom12(firstPoint[0], firstPoint[1]));
11978
+ updatedPoints.push(pointFrom13(firstPoint[0], firstPoint[1]));
11899
11979
  } else {
11900
- updatedPoints[updatedPoints.length - 1] = pointFrom12(
11980
+ updatedPoints[updatedPoints.length - 1] = pointFrom13(
11901
11981
  firstPoint[0],
11902
11982
  firstPoint[1]
11903
11983
  );
@@ -11951,9 +12031,9 @@ var ElementBounds = class _ElementBounds {
11951
12031
  if (isFreeDrawElement(element)) {
11952
12032
  const [minX, minY, maxX, maxY] = getBoundsFromPoints(
11953
12033
  element.points.map(
11954
- ([x, y]) => pointRotateRads11(
11955
- pointFrom13(x, y),
11956
- pointFrom13(cx - element.x, cy - element.y),
12034
+ ([x, y]) => pointRotateRads12(
12035
+ pointFrom14(x, y),
12036
+ pointFrom14(cx - element.x, cy - element.y),
11957
12037
  element.angle
11958
12038
  )
11959
12039
  )
@@ -11967,24 +12047,24 @@ var ElementBounds = class _ElementBounds {
11967
12047
  } else if (isLinearElement(element)) {
11968
12048
  bounds = getLinearElementRotatedBounds(element, cx, cy, elementsMap);
11969
12049
  } else if (element.type === "diamond") {
11970
- const [x11, y11] = pointRotateRads11(
11971
- pointFrom13(cx, y1),
11972
- pointFrom13(cx, cy),
12050
+ const [x11, y11] = pointRotateRads12(
12051
+ pointFrom14(cx, y1),
12052
+ pointFrom14(cx, cy),
11973
12053
  element.angle
11974
12054
  );
11975
- const [x12, y12] = pointRotateRads11(
11976
- pointFrom13(cx, y2),
11977
- pointFrom13(cx, cy),
12055
+ const [x12, y12] = pointRotateRads12(
12056
+ pointFrom14(cx, y2),
12057
+ pointFrom14(cx, cy),
11978
12058
  element.angle
11979
12059
  );
11980
- const [x22, y22] = pointRotateRads11(
11981
- pointFrom13(x1, cy),
11982
- pointFrom13(cx, cy),
12060
+ const [x22, y22] = pointRotateRads12(
12061
+ pointFrom14(x1, cy),
12062
+ pointFrom14(cx, cy),
11983
12063
  element.angle
11984
12064
  );
11985
- const [x21, y21] = pointRotateRads11(
11986
- pointFrom13(x2, cy),
11987
- pointFrom13(cx, cy),
12065
+ const [x21, y21] = pointRotateRads12(
12066
+ pointFrom14(x2, cy),
12067
+ pointFrom14(cx, cy),
11988
12068
  element.angle
11989
12069
  );
11990
12070
  const minX = Math.min(x11, x12, x22, x21);
@@ -12001,24 +12081,24 @@ var ElementBounds = class _ElementBounds {
12001
12081
  const hh = Math.hypot(h * cos, w * sin);
12002
12082
  bounds = [cx - ww, cy - hh, cx + ww, cy + hh];
12003
12083
  } else {
12004
- const [x11, y11] = pointRotateRads11(
12005
- pointFrom13(x1, y1),
12006
- pointFrom13(cx, cy),
12084
+ const [x11, y11] = pointRotateRads12(
12085
+ pointFrom14(x1, y1),
12086
+ pointFrom14(cx, cy),
12007
12087
  element.angle
12008
12088
  );
12009
- const [x12, y12] = pointRotateRads11(
12010
- pointFrom13(x1, y2),
12011
- pointFrom13(cx, cy),
12089
+ const [x12, y12] = pointRotateRads12(
12090
+ pointFrom14(x1, y2),
12091
+ pointFrom14(cx, cy),
12012
12092
  element.angle
12013
12093
  );
12014
- const [x22, y22] = pointRotateRads11(
12015
- pointFrom13(x2, y2),
12016
- pointFrom13(cx, cy),
12094
+ const [x22, y22] = pointRotateRads12(
12095
+ pointFrom14(x2, y2),
12096
+ pointFrom14(cx, cy),
12017
12097
  element.angle
12018
12098
  );
12019
- const [x21, y21] = pointRotateRads11(
12020
- pointFrom13(x2, y1),
12021
- pointFrom13(cx, cy),
12099
+ const [x21, y21] = pointRotateRads12(
12100
+ pointFrom14(x2, y1),
12101
+ pointFrom14(cx, cy),
12022
12102
  element.angle
12023
12103
  );
12024
12104
  const minX = Math.min(x11, x12, x22, x21);
@@ -12072,20 +12152,38 @@ var getElementLineSegments = (element, elementsMap) => {
12072
12152
  element,
12073
12153
  elementsMap
12074
12154
  );
12075
- const center = pointFrom13(cx, cy);
12155
+ const center = pointFrom14(cx, cy);
12076
12156
  if (shape.type === "polycurve") {
12077
12157
  const curves = shape.data;
12078
- const points = curves.map((curve4) => pointsOnBezierCurves(curve4, 10)).flat();
12079
- let i = 0;
12158
+ const pointsOnCurves = curves.map(
12159
+ (curve4) => pointsOnBezierCurves(curve4, 10)
12160
+ );
12080
12161
  const segments = [];
12081
- while (i < points.length - 1) {
12082
- segments.push(
12083
- lineSegment5(
12084
- pointFrom13(points[i][0], points[i][1]),
12085
- pointFrom13(points[i + 1][0], points[i + 1][1])
12086
- )
12087
- );
12088
- i++;
12162
+ if (isLineElement(element) && !element.polygon || isArrowElement(element)) {
12163
+ for (const points of pointsOnCurves) {
12164
+ let i = 0;
12165
+ while (i < points.length - 1) {
12166
+ segments.push(
12167
+ lineSegment6(
12168
+ pointFrom14(points[i][0], points[i][1]),
12169
+ pointFrom14(points[i + 1][0], points[i + 1][1])
12170
+ )
12171
+ );
12172
+ i++;
12173
+ }
12174
+ }
12175
+ } else {
12176
+ const points = pointsOnCurves.flat();
12177
+ let i = 0;
12178
+ while (i < points.length - 1) {
12179
+ segments.push(
12180
+ lineSegment6(
12181
+ pointFrom14(points[i][0], points[i][1]),
12182
+ pointFrom14(points[i + 1][0], points[i + 1][1])
12183
+ )
12184
+ );
12185
+ i++;
12186
+ }
12089
12187
  }
12090
12188
  return segments;
12091
12189
  } else if (shape.type === "polyline") {
@@ -12105,10 +12203,10 @@ var getElementLineSegments = (element, elementsMap) => {
12105
12203
  const container = getContainerElement(element, elementsMap);
12106
12204
  if (container && isLinearElement(container)) {
12107
12205
  const segments2 = [
12108
- lineSegment5(pointFrom13(x1, y1), pointFrom13(x2, y1)),
12109
- lineSegment5(pointFrom13(x2, y1), pointFrom13(x2, y2)),
12110
- lineSegment5(pointFrom13(x2, y2), pointFrom13(x1, y2)),
12111
- lineSegment5(pointFrom13(x1, y2), pointFrom13(x1, y1))
12206
+ lineSegment6(pointFrom14(x1, y1), pointFrom14(x2, y1)),
12207
+ lineSegment6(pointFrom14(x2, y1), pointFrom14(x2, y2)),
12208
+ lineSegment6(pointFrom14(x2, y2), pointFrom14(x1, y2)),
12209
+ lineSegment6(pointFrom14(x1, y2), pointFrom14(x1, y1))
12112
12210
  ];
12113
12211
  return segments2;
12114
12212
  }
@@ -12116,7 +12214,7 @@ var getElementLineSegments = (element, elementsMap) => {
12116
12214
  const points = shape.data;
12117
12215
  const segments = [];
12118
12216
  for (let i = 0; i < points.length - 1; i++) {
12119
- segments.push(lineSegment5(points[i], points[i + 1]));
12217
+ segments.push(lineSegment6(points[i], points[i + 1]));
12120
12218
  }
12121
12219
  return segments;
12122
12220
  } else if (shape.type === "ellipse") {
@@ -12131,16 +12229,16 @@ var getElementLineSegments = (element, elementsMap) => {
12131
12229
  [cx, y2],
12132
12230
  [x1, cy],
12133
12231
  [x2, cy]
12134
- ].map((point) => pointRotateRads11(point, center, element.angle));
12232
+ ].map((point) => pointRotateRads12(point, center, element.angle));
12135
12233
  return [
12136
- lineSegment5(nw, ne),
12137
- lineSegment5(sw, se2),
12138
- lineSegment5(nw, sw),
12139
- lineSegment5(ne, se2),
12140
- lineSegment5(nw, e),
12141
- lineSegment5(sw, e),
12142
- lineSegment5(ne, w),
12143
- lineSegment5(se2, w)
12234
+ lineSegment6(nw, ne),
12235
+ lineSegment6(sw, se2),
12236
+ lineSegment6(nw, sw),
12237
+ lineSegment6(ne, se2),
12238
+ lineSegment6(nw, e),
12239
+ lineSegment6(sw, e),
12240
+ lineSegment6(ne, w),
12241
+ lineSegment6(se2, w)
12144
12242
  ];
12145
12243
  };
12146
12244
  var _isRectanguloidElement = (element) => {
@@ -12148,9 +12246,9 @@ var _isRectanguloidElement = (element) => {
12148
12246
  };
12149
12247
  var getRotatedSides = (sides, center, angle) => {
12150
12248
  return sides.map((side) => {
12151
- return lineSegment5(
12152
- pointRotateRads11(side[0], center, angle),
12153
- pointRotateRads11(side[1], center, angle)
12249
+ return lineSegment6(
12250
+ pointRotateRads12(side[0], center, angle),
12251
+ pointRotateRads12(side[1], center, angle)
12154
12252
  );
12155
12253
  });
12156
12254
  };
@@ -12160,14 +12258,14 @@ var getSegmentsOnCurve = (curve4, center, angle) => {
12160
12258
  const segments = [];
12161
12259
  while (i < points.length - 1) {
12162
12260
  segments.push(
12163
- lineSegment5(
12164
- pointRotateRads11(
12165
- pointFrom13(points[i][0], points[i][1]),
12261
+ lineSegment6(
12262
+ pointRotateRads12(
12263
+ pointFrom14(points[i][0], points[i][1]),
12166
12264
  center,
12167
12265
  angle
12168
12266
  ),
12169
- pointRotateRads11(
12170
- pointFrom13(points[i + 1][0], points[i + 1][1]),
12267
+ pointRotateRads12(
12268
+ pointFrom14(points[i + 1][0], points[i + 1][1]),
12171
12269
  center,
12172
12270
  angle
12173
12271
  )
@@ -12178,7 +12276,7 @@ var getSegmentsOnCurve = (curve4, center, angle) => {
12178
12276
  return segments;
12179
12277
  };
12180
12278
  var getSegmentsOnEllipse = (ellipse4) => {
12181
- const center = pointFrom13(
12279
+ const center = pointFrom14(
12182
12280
  ellipse4.x + ellipse4.width / 2,
12183
12281
  ellipse4.y + ellipse4.height / 2
12184
12282
  );
@@ -12192,12 +12290,12 @@ var getSegmentsOnEllipse = (ellipse4) => {
12192
12290
  const t = i * deltaT;
12193
12291
  const x = center[0] + a2 * Math.cos(t);
12194
12292
  const y = center[1] + b2 * Math.sin(t);
12195
- points.push(pointRotateRads11(pointFrom13(x, y), center, ellipse4.angle));
12293
+ points.push(pointRotateRads12(pointFrom14(x, y), center, ellipse4.angle));
12196
12294
  }
12197
12295
  for (let i = 0; i < points.length - 1; i++) {
12198
- segments.push(lineSegment5(points[i], points[i + 1]));
12296
+ segments.push(lineSegment6(points[i], points[i + 1]));
12199
12297
  }
12200
- segments.push(lineSegment5(points[points.length - 1], points[0]));
12298
+ segments.push(lineSegment6(points[points.length - 1], points[0]));
12201
12299
  return segments;
12202
12300
  };
12203
12301
  var getRectangleBoxAbsoluteCoords = (boxSceneCoords) => {
@@ -12275,17 +12373,17 @@ var getCubicBezierCurveBound = (p0, p1, p2, p3) => {
12275
12373
  return [minX, minY, maxX, maxY];
12276
12374
  };
12277
12375
  var getMinMaxXYFromCurvePathOps = (ops, transformXY) => {
12278
- let currentP = pointFrom13(0, 0);
12376
+ let currentP = pointFrom14(0, 0);
12279
12377
  const { minX, minY, maxX, maxY } = ops.reduce(
12280
12378
  (limits, { op, data }) => {
12281
12379
  if (op === "move") {
12282
12380
  const p = pointFromArray3(data);
12283
- invariant7(p != null, "Op data is not a point");
12381
+ invariant8(p != null, "Op data is not a point");
12284
12382
  currentP = p;
12285
12383
  } else if (op === "bcurveTo") {
12286
- const _p1 = pointFrom13(data[0], data[1]);
12287
- const _p2 = pointFrom13(data[2], data[3]);
12288
- const _p3 = pointFrom13(data[4], data[5]);
12384
+ const _p1 = pointFrom14(data[0], data[1]);
12385
+ const _p2 = pointFrom14(data[2], data[3]);
12386
+ const _p3 = pointFrom14(data[4], data[5]);
12289
12387
  const p1 = transformXY ? transformXY(_p1) : _p1;
12290
12388
  const p2 = transformXY ? transformXY(_p2) : _p2;
12291
12389
  const p3 = transformXY ? transformXY(_p3) : _p3;
@@ -12366,18 +12464,18 @@ var getArrowheadPoints = (element, shape, position, arrowhead) => {
12366
12464
  }
12367
12465
  const index = position === "start" ? 1 : ops.length - 1;
12368
12466
  const data = ops[index].data;
12369
- invariant7(data.length === 6, "Op data length is not 6");
12370
- const p3 = pointFrom13(data[4], data[5]);
12371
- const p2 = pointFrom13(data[2], data[3]);
12372
- const p1 = pointFrom13(data[0], data[1]);
12467
+ invariant8(data.length === 6, "Op data length is not 6");
12468
+ const p3 = pointFrom14(data[4], data[5]);
12469
+ const p2 = pointFrom14(data[2], data[3]);
12470
+ const p1 = pointFrom14(data[0], data[1]);
12373
12471
  const prevOp = ops[index - 1];
12374
- let p0 = pointFrom13(0, 0);
12472
+ let p0 = pointFrom14(0, 0);
12375
12473
  if (prevOp.op === "move") {
12376
12474
  const p = pointFromArray3(prevOp.data);
12377
- invariant7(p != null, "Op data is not a point");
12475
+ invariant8(p != null, "Op data is not a point");
12378
12476
  p0 = p;
12379
12477
  } else if (prevOp.op === "bcurveTo") {
12380
- p0 = pointFrom13(prevOp.data[4], prevOp.data[5]);
12478
+ p0 = pointFrom14(prevOp.data[4], prevOp.data[5]);
12381
12479
  }
12382
12480
  const equation = (t, idx) => Math.pow(1 - t, 3) * p3[idx] + 3 * t * Math.pow(1 - t, 2) * p2[idx] + 3 * Math.pow(t, 2) * (1 - t) * p1[idx] + p0[idx] * Math.pow(t, 3);
12383
12481
  const [x2, y2] = position === "start" ? p0 : p3;
@@ -12402,26 +12500,26 @@ var getArrowheadPoints = (element, shape, position, arrowhead) => {
12402
12500
  }
12403
12501
  const angle = getArrowheadAngle(arrowhead);
12404
12502
  if (arrowhead === "crowfoot_many" || arrowhead === "crowfoot_one_or_many") {
12405
- const [x32, y32] = pointRotateRads11(
12406
- pointFrom13(x2, y2),
12407
- pointFrom13(xs, ys),
12503
+ const [x32, y32] = pointRotateRads12(
12504
+ pointFrom14(x2, y2),
12505
+ pointFrom14(xs, ys),
12408
12506
  degreesToRadians(-angle)
12409
12507
  );
12410
- const [x42, y42] = pointRotateRads11(
12411
- pointFrom13(x2, y2),
12412
- pointFrom13(xs, ys),
12508
+ const [x42, y42] = pointRotateRads12(
12509
+ pointFrom14(x2, y2),
12510
+ pointFrom14(xs, ys),
12413
12511
  degreesToRadians(angle)
12414
12512
  );
12415
12513
  return [xs, ys, x32, y32, x42, y42];
12416
12514
  }
12417
- const [x3, y3] = pointRotateRads11(
12418
- pointFrom13(xs, ys),
12419
- pointFrom13(x2, y2),
12515
+ const [x3, y3] = pointRotateRads12(
12516
+ pointFrom14(xs, ys),
12517
+ pointFrom14(x2, y2),
12420
12518
  -angle * Math.PI / 180
12421
12519
  );
12422
- const [x4, y4] = pointRotateRads11(
12423
- pointFrom13(xs, ys),
12424
- pointFrom13(x2, y2),
12520
+ const [x4, y4] = pointRotateRads12(
12521
+ pointFrom14(xs, ys),
12522
+ pointFrom14(x2, y2),
12425
12523
  degreesToRadians(angle)
12426
12524
  );
12427
12525
  if (arrowhead === "diamond" || arrowhead === "diamond_outline") {
@@ -12429,16 +12527,16 @@ var getArrowheadPoints = (element, shape, position, arrowhead) => {
12429
12527
  let oy;
12430
12528
  if (position === "start") {
12431
12529
  const [px, py] = element.points.length > 1 ? element.points[1] : [0, 0];
12432
- [ox, oy] = pointRotateRads11(
12433
- pointFrom13(x2 + minSize * 2, y2),
12434
- pointFrom13(x2, y2),
12530
+ [ox, oy] = pointRotateRads12(
12531
+ pointFrom14(x2 + minSize * 2, y2),
12532
+ pointFrom14(x2, y2),
12435
12533
  Math.atan2(py - y2, px - x2)
12436
12534
  );
12437
12535
  } else {
12438
12536
  const [px, py] = element.points.length > 1 ? element.points[element.points.length - 2] : [0, 0];
12439
- [ox, oy] = pointRotateRads11(
12440
- pointFrom13(x2 - minSize * 2, y2),
12441
- pointFrom13(x2, y2),
12537
+ [ox, oy] = pointRotateRads12(
12538
+ pointFrom14(x2 - minSize * 2, y2),
12539
+ pointFrom14(x2, y2),
12442
12540
  Math.atan2(y2 - py, x2 - px)
12443
12541
  );
12444
12542
  }
@@ -12467,9 +12565,9 @@ var getLinearElementRotatedBounds = (element, cx, cy, elementsMap) => {
12467
12565
  const boundTextElement = getBoundTextElement(element, elementsMap);
12468
12566
  if (element.points.length < 2) {
12469
12567
  const [pointX, pointY] = element.points[0];
12470
- const [x, y] = pointRotateRads11(
12471
- pointFrom13(element.x + pointX, element.y + pointY),
12472
- pointFrom13(cx, cy),
12568
+ const [x, y] = pointRotateRads12(
12569
+ pointFrom14(element.x + pointX, element.y + pointY),
12570
+ pointFrom14(cx, cy),
12473
12571
  element.angle
12474
12572
  );
12475
12573
  let coords2 = [x, y, x, y];
@@ -12492,9 +12590,9 @@ var getLinearElementRotatedBounds = (element, cx, cy, elementsMap) => {
12492
12590
  const cachedShape = ShapeCache.get(element)?.[0];
12493
12591
  const shape = cachedShape ?? generateLinearElementShape(element);
12494
12592
  const ops = getCurvePathOps(shape);
12495
- const transformXY = ([x, y]) => pointRotateRads11(
12496
- pointFrom13(element.x + x, element.y + y),
12497
- pointFrom13(cx, cy),
12593
+ const transformXY = ([x, y]) => pointRotateRads12(
12594
+ pointFrom14(element.x + x, element.y + y),
12595
+ pointFrom14(cx, cy),
12498
12596
  element.angle
12499
12597
  );
12500
12598
  const res = getMinMaxXYFromCurvePathOps(ops, transformXY);
@@ -12605,8 +12703,8 @@ var getClosestElementBounds = (elements, from) => {
12605
12703
  elements.forEach((element) => {
12606
12704
  const [x1, y1, x2, y2] = getElementBounds(element, elementsMap);
12607
12705
  const distance3 = pointDistance7(
12608
- pointFrom13((x1 + x2) / 2, (y1 + y2) / 2),
12609
- pointFrom13(from.x, from.y)
12706
+ pointFrom14((x1 + x2) / 2, (y1 + y2) / 2),
12707
+ pointFrom14(from.x, from.y)
12610
12708
  );
12611
12709
  if (distance3 < minDistance) {
12612
12710
  minDistance = distance3;
@@ -12642,7 +12740,7 @@ var getVisibleSceneBounds = ({
12642
12740
  -scrollY + height / zoom.value
12643
12741
  ];
12644
12742
  };
12645
- var getCenterForBounds = (bounds) => pointFrom13(
12743
+ var getCenterForBounds = (bounds) => pointFrom14(
12646
12744
  bounds[0] + (bounds[2] - bounds[0]) / 2,
12647
12745
  bounds[1] + (bounds[3] - bounds[1]) / 2
12648
12746
  );
@@ -12656,23 +12754,23 @@ var aabbForElement = (element, elementsMap, offset) => {
12656
12754
  midY: element.y + element.height / 2
12657
12755
  };
12658
12756
  const center = elementCenterPoint(element, elementsMap);
12659
- const [topLeftX, topLeftY] = pointRotateRads11(
12660
- pointFrom13(bbox.minX, bbox.minY),
12757
+ const [topLeftX, topLeftY] = pointRotateRads12(
12758
+ pointFrom14(bbox.minX, bbox.minY),
12661
12759
  center,
12662
12760
  element.angle
12663
12761
  );
12664
- const [topRightX, topRightY] = pointRotateRads11(
12665
- pointFrom13(bbox.maxX, bbox.minY),
12762
+ const [topRightX, topRightY] = pointRotateRads12(
12763
+ pointFrom14(bbox.maxX, bbox.minY),
12666
12764
  center,
12667
12765
  element.angle
12668
12766
  );
12669
- const [bottomRightX, bottomRightY] = pointRotateRads11(
12670
- pointFrom13(bbox.maxX, bbox.maxY),
12767
+ const [bottomRightX, bottomRightY] = pointRotateRads12(
12768
+ pointFrom14(bbox.maxX, bbox.maxY),
12671
12769
  center,
12672
12770
  element.angle
12673
12771
  );
12674
- const [bottomLeftX, bottomLeftY] = pointRotateRads11(
12675
- pointFrom13(bbox.minX, bbox.maxY),
12772
+ const [bottomLeftX, bottomLeftY] = pointRotateRads12(
12773
+ pointFrom14(bbox.minX, bbox.maxY),
12676
12774
  center,
12677
12775
  element.angle
12678
12776
  );
@@ -12704,7 +12802,7 @@ var doBoundsIntersect = (bounds1, bounds2) => {
12704
12802
  };
12705
12803
  var elementCenterPoint = (element, elementsMap, xOffset = 0, yOffset = 0) => {
12706
12804
  const [x, y] = getCenterForBounds(getElementBounds(element, elementsMap));
12707
- return pointFrom13(x + xOffset, y + yOffset);
12805
+ return pointFrom14(x + xOffset, y + yOffset);
12708
12806
  };
12709
12807
 
12710
12808
  // src/sizeHelpers.ts
@@ -16935,8 +17033,8 @@ var embeddableURLValidator = (url, validateEmbeddable) => {
16935
17033
 
16936
17034
  // src/flowchart.ts
16937
17035
  init_define_import_meta_env();
16938
- import { KEYS as KEYS3, invariant as invariant8, toBrandedType as toBrandedType2 } from "@excalidraw/common";
16939
- import { pointFrom as pointFrom14 } from "@excalidraw/math";
17036
+ import { KEYS as KEYS3, invariant as invariant9, toBrandedType as toBrandedType2 } from "@excalidraw/common";
17037
+ import { pointFrom as pointFrom15 } from "@excalidraw/math";
16940
17038
  var VERTICAL_OFFSET = 100;
16941
17039
  var HORIZONTAL_OFFSET = 100;
16942
17040
  var getLinkDirectionFromKey = (key) => {
@@ -16965,7 +17063,7 @@ var getNodeRelatives = (type, node, elementsMap, direction) => {
16965
17063
  if (!relative) {
16966
17064
  return acc;
16967
17065
  }
16968
- invariant8(
17066
+ invariant9(
16969
17067
  isBindableElement(relative),
16970
17068
  "not an ExcalidrawBindableElement"
16971
17069
  );
@@ -17081,7 +17179,7 @@ var addNewNode = (element, appState, direction, scene) => {
17081
17179
  fillStyle: element.fillStyle,
17082
17180
  strokeStyle: element.strokeStyle
17083
17181
  });
17084
- invariant8(
17182
+ invariant9(
17085
17183
  isFlowchartNodeElement(nextNode),
17086
17184
  "not an ExcalidrawFlowchartNodeElement"
17087
17185
  );
@@ -17139,7 +17237,7 @@ var addNewNodes = (startNode, appState, direction, scene, numberOfNodes) => {
17139
17237
  fillStyle: startNode.fillStyle,
17140
17238
  strokeStyle: startNode.strokeStyle
17141
17239
  });
17142
- invariant8(
17240
+ invariant9(
17143
17241
  isFlowchartNodeElement(nextNode),
17144
17242
  "not an ExcalidrawFlowchartNodeElement"
17145
17243
  );
@@ -17216,7 +17314,7 @@ var createBindingArrow = (startBindingElement, endBindingElement, direction, app
17216
17314
  strokeWidth: startBindingElement.strokeWidth,
17217
17315
  opacity: startBindingElement.opacity,
17218
17316
  roughness: startBindingElement.roughness,
17219
- points: [pointFrom14(0, 0), pointFrom14(endX, endY)],
17317
+ points: [pointFrom15(0, 0), pointFrom15(endX, endY)],
17220
17318
  elbowed: true
17221
17319
  });
17222
17320
  const elementsMap = scene.getNonDeletedElementsMap();
@@ -17365,7 +17463,7 @@ var FlowChartCreator = class {
17365
17463
  }
17366
17464
  if (startNode.frameId) {
17367
17465
  const frame = elementsMap.get(startNode.frameId);
17368
- invariant8(
17466
+ invariant9(
17369
17467
  frame && isFrameElement(frame),
17370
17468
  "not an ExcalidrawFrameElement"
17371
17469
  );
@@ -17572,8 +17670,8 @@ init_define_import_meta_env();
17572
17670
  import {
17573
17671
  pointCenter as pointCenter3,
17574
17672
  normalizeRadians as normalizeRadians2,
17575
- pointFrom as pointFrom15,
17576
- pointRotateRads as pointRotateRads12
17673
+ pointFrom as pointFrom16,
17674
+ pointRotateRads as pointRotateRads13
17577
17675
  } from "@excalidraw/math";
17578
17676
  import {
17579
17677
  MIN_FONT_SIZE,
@@ -17747,7 +17845,7 @@ var resizeSingleTextElement = (origElement, element, scene, transformHandleType,
17747
17845
  return;
17748
17846
  }
17749
17847
  if (transformHandleType.includes("n") || transformHandleType.includes("s")) {
17750
- const previousOrigin = pointFrom15(origElement.x, origElement.y);
17848
+ const previousOrigin = pointFrom16(origElement.x, origElement.y);
17751
17849
  const newOrigin = getResizedOrigin(
17752
17850
  previousOrigin,
17753
17851
  origElement.width,
@@ -17788,7 +17886,7 @@ var resizeSingleTextElement = (origElement, element, scene, transformHandleType,
17788
17886
  element.lineHeight
17789
17887
  );
17790
17888
  const newHeight = metrics2.height;
17791
- const previousOrigin = pointFrom15(origElement.x, origElement.y);
17889
+ const previousOrigin = pointFrom16(origElement.x, origElement.y);
17792
17890
  const newOrigin = getResizedOrigin(
17793
17891
  previousOrigin,
17794
17892
  origElement.width,
@@ -17824,9 +17922,9 @@ var rotateMultipleElements = (originalElements, elements, scene, pointerX, point
17824
17922
  const cx = (x1 + x2) / 2;
17825
17923
  const cy = (y1 + y2) / 2;
17826
17924
  const origAngle = originalElements.get(element.id)?.angle ?? element.angle;
17827
- const [rotatedCX, rotatedCY] = pointRotateRads12(
17828
- pointFrom15(cx, cy),
17829
- pointFrom15(centerX, centerY),
17925
+ const [rotatedCX, rotatedCY] = pointRotateRads13(
17926
+ pointFrom16(cx, cy),
17927
+ pointFrom16(centerX, centerY),
17830
17928
  centerAngle + origAngle - element.angle
17831
17929
  );
17832
17930
  const updates = isElbowArrow(element) ? {
@@ -17863,44 +17961,44 @@ var getResizeOffsetXY = (transformHandleType, selectedElements, elementsMap, x,
17863
17961
  const cx = (x1 + x2) / 2;
17864
17962
  const cy = (y1 + y2) / 2;
17865
17963
  const angle = selectedElements.length === 1 ? selectedElements[0].angle : 0;
17866
- [x, y] = pointRotateRads12(
17867
- pointFrom15(x, y),
17868
- pointFrom15(cx, cy),
17964
+ [x, y] = pointRotateRads13(
17965
+ pointFrom16(x, y),
17966
+ pointFrom16(cx, cy),
17869
17967
  -angle
17870
17968
  );
17871
17969
  switch (transformHandleType) {
17872
17970
  case "n":
17873
- return pointRotateRads12(
17874
- pointFrom15(x - (x1 + x2) / 2, y - y1),
17875
- pointFrom15(0, 0),
17971
+ return pointRotateRads13(
17972
+ pointFrom16(x - (x1 + x2) / 2, y - y1),
17973
+ pointFrom16(0, 0),
17876
17974
  angle
17877
17975
  );
17878
17976
  case "s":
17879
- return pointRotateRads12(
17880
- pointFrom15(x - (x1 + x2) / 2, y - y2),
17881
- pointFrom15(0, 0),
17977
+ return pointRotateRads13(
17978
+ pointFrom16(x - (x1 + x2) / 2, y - y2),
17979
+ pointFrom16(0, 0),
17882
17980
  angle
17883
17981
  );
17884
17982
  case "w":
17885
- return pointRotateRads12(
17886
- pointFrom15(x - x1, y - (y1 + y2) / 2),
17887
- pointFrom15(0, 0),
17983
+ return pointRotateRads13(
17984
+ pointFrom16(x - x1, y - (y1 + y2) / 2),
17985
+ pointFrom16(0, 0),
17888
17986
  angle
17889
17987
  );
17890
17988
  case "e":
17891
- return pointRotateRads12(
17892
- pointFrom15(x - x2, y - (y1 + y2) / 2),
17893
- pointFrom15(0, 0),
17989
+ return pointRotateRads13(
17990
+ pointFrom16(x - x2, y - (y1 + y2) / 2),
17991
+ pointFrom16(0, 0),
17894
17992
  angle
17895
17993
  );
17896
17994
  case "nw":
17897
- return pointRotateRads12(pointFrom15(x - x1, y - y1), pointFrom15(0, 0), angle);
17995
+ return pointRotateRads13(pointFrom16(x - x1, y - y1), pointFrom16(0, 0), angle);
17898
17996
  case "ne":
17899
- return pointRotateRads12(pointFrom15(x - x2, y - y1), pointFrom15(0, 0), angle);
17997
+ return pointRotateRads13(pointFrom16(x - x2, y - y1), pointFrom16(0, 0), angle);
17900
17998
  case "sw":
17901
- return pointRotateRads12(pointFrom15(x - x1, y - y2), pointFrom15(0, 0), angle);
17999
+ return pointRotateRads13(pointFrom16(x - x1, y - y2), pointFrom16(0, 0), angle);
17902
18000
  case "se":
17903
- return pointRotateRads12(pointFrom15(x - x2, y - y2), pointFrom15(0, 0), angle);
18001
+ return pointRotateRads13(pointFrom16(x - x2, y - y2), pointFrom16(0, 0), angle);
17904
18002
  default:
17905
18003
  return [0, 0];
17906
18004
  }
@@ -18063,10 +18161,10 @@ var resizeSingleElement = (nextWidth, nextHeight, latestElement, origElement, or
18063
18161
  nextHeight,
18064
18162
  true
18065
18163
  );
18066
- let previousOrigin = pointFrom15(origElement.x, origElement.y);
18164
+ let previousOrigin = pointFrom16(origElement.x, origElement.y);
18067
18165
  if (isLinearElement(origElement)) {
18068
18166
  const [x1, y1] = getElementBounds(origElement, originalElementsMap);
18069
- previousOrigin = pointFrom15(x1, y1);
18167
+ previousOrigin = pointFrom16(x1, y1);
18070
18168
  }
18071
18169
  const newOrigin = getResizedOrigin(
18072
18170
  previousOrigin,
@@ -18089,7 +18187,7 @@ var resizeSingleElement = (nextWidth, nextHeight, latestElement, origElement, or
18089
18187
  newOrigin.x += scaledX;
18090
18188
  newOrigin.y += scaledY;
18091
18189
  rescaledPoints.points = rescaledPoints.points.map(
18092
- (p) => pointFrom15(p[0] - scaledX, p[1] - scaledY)
18190
+ (p) => pointFrom16(p[0] - scaledX, p[1] - scaledY)
18093
18191
  );
18094
18192
  }
18095
18193
  if (nextWidth < 0) {
@@ -18152,11 +18250,11 @@ var getNextSingleWidthAndHeightFromPointer = (latestElement, origElement, handle
18152
18250
  origElement.height,
18153
18251
  true
18154
18252
  );
18155
- const startTopLeft = pointFrom15(x1, y1);
18156
- const startBottomRight = pointFrom15(x2, y2);
18253
+ const startTopLeft = pointFrom16(x1, y1);
18254
+ const startBottomRight = pointFrom16(x2, y2);
18157
18255
  const startCenter = pointCenter3(startTopLeft, startBottomRight);
18158
- const rotatedPointer = pointRotateRads12(
18159
- pointFrom15(pointerX, pointerY),
18256
+ const rotatedPointer = pointRotateRads13(
18257
+ pointFrom16(pointerX, pointerY),
18160
18258
  startCenter,
18161
18259
  -origElement.angle
18162
18260
  );
@@ -18514,9 +18612,9 @@ var resizeMultipleElements = (selectedElements, elementsMap, handleDirection, sc
18514
18612
  // src/resizeTest.ts
18515
18613
  init_define_import_meta_env();
18516
18614
  import {
18517
- pointFrom as pointFrom17,
18615
+ pointFrom as pointFrom18,
18518
18616
  pointOnLineSegment,
18519
- pointRotateRads as pointRotateRads14
18617
+ pointRotateRads as pointRotateRads15
18520
18618
  } from "@excalidraw/math";
18521
18619
  import { SIDE_RESIZING_THRESHOLD } from "@excalidraw/common";
18522
18620
 
@@ -18525,9 +18623,10 @@ init_define_import_meta_env();
18525
18623
  import {
18526
18624
  DEFAULT_TRANSFORM_HANDLE_SPACING,
18527
18625
  isAndroid,
18528
- isIOS
18626
+ isIOS,
18627
+ isMobileOrTablet
18529
18628
  } from "@excalidraw/common";
18530
- import { pointFrom as pointFrom16, pointRotateRads as pointRotateRads13 } from "@excalidraw/math";
18629
+ import { pointFrom as pointFrom17, pointRotateRads as pointRotateRads14 } from "@excalidraw/math";
18531
18630
  var transformHandleSizes = {
18532
18631
  mouse: 8,
18533
18632
  pen: 16,
@@ -18568,9 +18667,9 @@ var OMIT_SIDES_FOR_LINE_BACKSLASH = {
18568
18667
  w: true
18569
18668
  };
18570
18669
  var generateTransformHandle = (x, y, width, height, cx, cy, angle) => {
18571
- const [xx, yy] = pointRotateRads13(
18572
- pointFrom16(x + width / 2, y + height / 2),
18573
- pointFrom16(cx, cy),
18670
+ const [xx, yy] = pointRotateRads14(
18671
+ pointFrom17(x + width / 2, y + height / 2),
18672
+ pointFrom17(cx, cy),
18574
18673
  angle
18575
18674
  );
18576
18675
  return [xx - width / 2, yy - height / 2, width, height];
@@ -18735,7 +18834,7 @@ var getTransformHandles = (element, zoom, elementsMap, pointerType = "mouse", om
18735
18834
  isImageElement(element) ? 0 : void 0
18736
18835
  );
18737
18836
  };
18738
- var shouldShowBoundingBox = (elements, appState) => {
18837
+ var hasBoundingBox = (elements, appState) => {
18739
18838
  if (appState.selectedLinearElement?.isEditing) {
18740
18839
  return false;
18741
18840
  }
@@ -18749,7 +18848,7 @@ var shouldShowBoundingBox = (elements, appState) => {
18749
18848
  if (!isLinearElement(element)) {
18750
18849
  return true;
18751
18850
  }
18752
- return element.points.length > 2;
18851
+ return element.points.length > 2 && !isMobileOrTablet();
18753
18852
  };
18754
18853
 
18755
18854
  // src/resizeTest.ts
@@ -18787,14 +18886,14 @@ var resizeTest = (element, elementsMap, appState, x, y, zoom, pointerType, devic
18787
18886
  const SPACING = isImageElement(element) ? 0 : SIDE_RESIZING_THRESHOLD / zoom.value;
18788
18887
  const ZOOMED_SIDE_RESIZING_THRESHOLD = SIDE_RESIZING_THRESHOLD / zoom.value;
18789
18888
  const sides = getSelectionBorders(
18790
- pointFrom17(x1 - SPACING, y1 - SPACING),
18791
- pointFrom17(x2 + SPACING, y2 + SPACING),
18792
- pointFrom17(cx, cy),
18889
+ pointFrom18(x1 - SPACING, y1 - SPACING),
18890
+ pointFrom18(x2 + SPACING, y2 + SPACING),
18891
+ pointFrom18(cx, cy),
18793
18892
  element.angle
18794
18893
  );
18795
18894
  for (const [dir, side] of Object.entries(sides)) {
18796
18895
  if (pointOnLineSegment(
18797
- pointFrom17(x, y),
18896
+ pointFrom18(x, y),
18798
18897
  side,
18799
18898
  ZOOMED_SIDE_RESIZING_THRESHOLD
18800
18899
  )) {
@@ -18843,14 +18942,14 @@ var getTransformHandleTypeFromCoords = ([x1, y1, x2, y2], scenePointerX, scenePo
18843
18942
  const cy = (y1 + y2) / 2;
18844
18943
  const SPACING = SIDE_RESIZING_THRESHOLD / zoom.value;
18845
18944
  const sides = getSelectionBorders(
18846
- pointFrom17(x1 - SPACING, y1 - SPACING),
18847
- pointFrom17(x2 + SPACING, y2 + SPACING),
18848
- pointFrom17(cx, cy),
18945
+ pointFrom18(x1 - SPACING, y1 - SPACING),
18946
+ pointFrom18(x2 + SPACING, y2 + SPACING),
18947
+ pointFrom18(cx, cy),
18849
18948
  0
18850
18949
  );
18851
18950
  for (const [dir, side] of Object.entries(sides)) {
18852
18951
  if (pointOnLineSegment(
18853
- pointFrom17(scenePointerX, scenePointerY),
18952
+ pointFrom18(scenePointerX, scenePointerY),
18854
18953
  side,
18855
18954
  SPACING
18856
18955
  )) {
@@ -18907,10 +19006,10 @@ var getCursorForResizingElement = (resizingElement) => {
18907
19006
  return cursor ? `${cursor}-resize` : "";
18908
19007
  };
18909
19008
  var getSelectionBorders = ([x1, y1], [x2, y2], center, angle) => {
18910
- const topLeft = pointRotateRads14(pointFrom17(x1, y1), center, angle);
18911
- const topRight = pointRotateRads14(pointFrom17(x2, y1), center, angle);
18912
- const bottomLeft = pointRotateRads14(pointFrom17(x1, y2), center, angle);
18913
- const bottomRight = pointRotateRads14(pointFrom17(x2, y2), center, angle);
19009
+ const topLeft = pointRotateRads15(pointFrom18(x1, y1), center, angle);
19010
+ const topRight = pointRotateRads15(pointFrom18(x2, y1), center, angle);
19011
+ const bottomLeft = pointRotateRads15(pointFrom18(x1, y2), center, angle);
19012
+ const bottomRight = pointRotateRads15(pointFrom18(x2, y2), center, angle);
18914
19013
  return {
18915
19014
  n: [topLeft, topRight],
18916
19015
  e: [topRight, bottomRight],
@@ -19451,6 +19550,8 @@ export {
19451
19550
  getFrameLikeTitle,
19452
19551
  getFreeDrawPath2D,
19453
19552
  getFreeDrawSvgPath,
19553
+ getFreedrawOutlineAsSegments,
19554
+ getFreedrawOutlinePoints,
19454
19555
  getGlobalFixedPointForBindableElement,
19455
19556
  getGlobalFixedPoints,
19456
19557
  getHeadingForElbowArrowSnap,
@@ -19510,6 +19611,7 @@ export {
19510
19611
  handleBindTextResize,
19511
19612
  hasBackground,
19512
19613
  hasBoundTextElement,
19614
+ hasBoundingBox,
19513
19615
  hasStrokeColor,
19514
19616
  hasStrokeStyle,
19515
19617
  hasStrokeWidth,
@@ -19638,7 +19740,6 @@ export {
19638
19740
  shouldAllowVerticalAlign,
19639
19741
  shouldApplyFrameClip,
19640
19742
  shouldEnableBindingForPointerEvent,
19641
- shouldShowBoundingBox,
19642
19743
  shouldTestInside,
19643
19744
  showSelectedShapeActions,
19644
19745
  snapToMid,