Преглед на файлове

compute midpoints properly when dealing with split line indices

Preet преди 1 година
родител
ревизия
26f9b54199
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      src/element/linearElementEditor.ts

+ 4 - 1
src/element/linearElementEditor.ts

@@ -547,7 +547,10 @@ export class LinearElementEditor {
     endPointIndex: number,
   ) {
     let segmentMidPoint = centerPoint(startPoint, endPoint);
-    if (element.points.length > 2 && element.roundness) {
+    const splits = element.segmentSplitIndices || [];
+    const treatAsCurve =
+      splits.includes(endPointIndex) || splits.includes(endPointIndex - 1);
+    if (element.points.length > 2 && (element.roundness || treatAsCurve)) {
       const controlPoints = getControlPointsForBezierCurve(
         element,
         element.points[endPointIndex],