From e71ca80ed44f30432f45c7d57d65a53d247154ea Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Wed, 17 Jun 2026 04:57:17 +0300 Subject: [PATCH] feat(otrack): remove a temporary tracking point by hovering over it There was no way to drop an acquired OTRACK point short of ending the command. Dwelling the cursor over an existing tracking point now toggles it off instead of re-acquiring it. Closes #109 Co-Authored-By: Claude Opus 4.8 --- src/snap/mod.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/snap/mod.rs b/src/snap/mod.rs index 62f835021..2d07cc693 100644 --- a/src/snap/mod.rs +++ b/src/snap/mod.rs @@ -200,15 +200,22 @@ impl Snapper { if is_same { self.dwell_count += 1; if self.dwell_count == DWELL_THRESHOLD { - // Acquire this point (max 4 tracked points). - if !self.tracking_points.iter().any(|t| { + // Dwelling over an already-acquired point removes it; + // otherwise acquire it (max 4 tracked points). + let existing = self.tracking_points.iter().position(|t| { let d = (*t - p).length(); d < self.grid_spacing * 0.1 - }) { - if self.tracking_points.len() >= 4 { - self.tracking_points.remove(0); + }); + match existing { + Some(idx) => { + self.tracking_points.remove(idx); + } + None => { + if self.tracking_points.len() >= 4 { + self.tracking_points.remove(0); + } + self.tracking_points.push(p); } - self.tracking_points.push(p); } } } else {