Aakansha Doshi 3 ani în urmă
părinte
comite
0b0846bd8e
1 a modificat fișierele cu 5 adăugiri și 4 ștergeri
  1. 5 4
      src/element/linearElementEditor.ts

+ 5 - 4
src/element/linearElementEditor.ts

@@ -791,19 +791,20 @@ export class LinearElementEditor {
 
     const pointHandles =
       LinearElementEditor.getPointsGlobalCoordinates(element);
-    let idx = linearElementEditor.visiblePointIndexes.length;
+    let counter = linearElementEditor.visiblePointIndexes.length;
 
     // loop from right to left because points on the right are rendered over
     // points on the left, thus should take precedence when clicking, if they
     // overlap
-    while (--idx > 0) {
-      const point = pointHandles[linearElementEditor.visiblePointIndexes[idx]];
+    while (--counter >= 0) {
+      const index = linearElementEditor.visiblePointIndexes[counter];
+      const point = pointHandles[index];
       if (
         distance2d(x, y, point[0], point[1]) * zoom.value <
         // +1px to account for outline stroke
         LinearElementEditor.POINT_HANDLE_SIZE + 1
       ) {
-        return idx;
+        return index;
       }
     }
     return -1;