浏览代码

hide n-1 point if distance is less than threshold

Aakansha Doshi 3 年之前
父节点
当前提交
330b3a0530
共有 1 个文件被更改,包括 6 次插入5 次删除
  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;
       }