Explorar o código

hide n-1 point if distance is less than threshold

Aakansha Doshi %!s(int64=3) %!d(string=hai) anos
pai
achega
330b3a0530
Modificáronse 1 ficheiros con 6 adicións e 5 borrados
  1. 6 5
      src/element/linearElementEditor.ts

+ 6 - 5
src/element/linearElementEditor.ts

@@ -437,11 +437,12 @@ export class LinearElementEditor {
           appState.zoom.value;
       }
       const isExtremePoint = index === 0 || index === element.points.length - 1;
-      if (
-        editingLinearElement ||
-        isExtremePoint ||
-        distance >= 2 * LinearElementEditor.POINT_HANDLE_SIZE
-      ) {
+      const threshold = 2 * LinearElementEditor.POINT_HANDLE_SIZE;
+      if (editingLinearElement || isExtremePoint || distance >= threshold) {
+        // hide n-1 point if distance is less than threshold
+        if (isExtremePoint && distance < threshold) {
+          visiblePointIndexes.pop();
+        }
         visiblePointIndexes.push(index);
         previousPoint = point;
       }