From 330b3a0530ffc4393720a80f92e396e45413c5b5 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Thu, 1 Sep 2022 17:51:50 +0530 Subject: [PATCH] hide n-1 point if distance is less than threshold --- src/element/linearElementEditor.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/element/linearElementEditor.ts b/src/element/linearElementEditor.ts index 048e5ea18..767c71bbe 100644 --- a/src/element/linearElementEditor.ts +++ b/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; }