forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
d041bea32a
commit
e71ca80ed4
1 file changed
+13
-6
+13
-6
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user