@excalidraw/element 0.18.0-91c7748 → 0.18.0-a8acc82

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.
package/dist/dev/index.js CHANGED
@@ -7276,6 +7276,28 @@ var bindPointToSnapToElementOutline = (arrow, bindableElement, startOrEnd, eleme
7276
7276
  intersector,
7277
7277
  FIXED_BINDING_DISTANCE
7278
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
+ }
7279
7301
  } else {
7280
7302
  intersection = intersectElementWithLineSegment(
7281
7303
  bindableElement,
@@ -12133,17 +12155,35 @@ var getElementLineSegments = (element, elementsMap) => {
12133
12155
  const center = pointFrom14(cx, cy);
12134
12156
  if (shape.type === "polycurve") {
12135
12157
  const curves = shape.data;
12136
- const points = curves.map((curve4) => pointsOnBezierCurves(curve4, 10)).flat();
12137
- let i = 0;
12158
+ const pointsOnCurves = curves.map(
12159
+ (curve4) => pointsOnBezierCurves(curve4, 10)
12160
+ );
12138
12161
  const segments = [];
12139
- while (i < points.length - 1) {
12140
- segments.push(
12141
- lineSegment6(
12142
- pointFrom14(points[i][0], points[i][1]),
12143
- pointFrom14(points[i + 1][0], points[i + 1][1])
12144
- )
12145
- );
12146
- 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
+ }
12147
12187
  }
12148
12188
  return segments;
12149
12189
  } else if (shape.type === "polyline") {