fix(otrack): clear and localize tracking hint

This commit is contained in:
Hakan Seven committed 2026-08-09 13:04:55 +03:00
1 parent ae24f985f0
commit d80ee709ac
4 files changed
+9 -11

No files matched your search

+1 -2
View File
@@ -430,8 +430,7 @@ pub(super) struct OpenCADStudio {
/// cursor is on a tracking ray. Lets a typed distance place a point along
/// the ray from the tracking point (issue #69). `None` when not aligned.
otrack_active: Option<(glam::DVec3, glam::DVec3)>,
/// Kind of the currently active tracking reference, kept separately from
/// `otrack_active` so typed-distance behavior remains unchanged.
/// Active OTRACK ray kind, separate from typed-distance geometry.
otrack_kind: Option<crate::snap::TrackingKind>,
/// Whether Tangent snap was enabled before a tangent-pick command started.
pre_cmd_tangent: Option<bool>,
+2
View File
@@ -3137,6 +3137,8 @@ impl OpenCADStudio {
self.snapper.otrack_enabled ^= true;
if !self.snapper.otrack_enabled {
self.snapper.clear_tracking();
self.otrack_active = None;
self.otrack_kind = None;
}
Task::none()
}
+2 -2
View File
@@ -812,10 +812,10 @@ impl OpenCADStudio {
let tracking_hint = match self.otrack_kind {
Some(crate::snap::TrackingKind::Perpendicular) => {
Some("Perpendicular".to_string())
Some(crate::tr!("common", "perpendicular"))
}
Some(crate::snap::TrackingKind::Extension) => {
Some("Extension".to_string())
Some(crate::tr!("common", "extension"))
}
_ => None,
};
+4 -7
View File
@@ -2193,7 +2193,7 @@ struct DynInputCanvas {
boxes: Vec<DynBox>,
/// The active command's current prompt, drawn just above the boxes.
prompt: String,
/// Informational tracking/reference mode currently engaged.
/// Active tracking-reference label.
tracking_hint: Option<String>,
}
@@ -2543,9 +2543,7 @@ impl DynInputCanvas {
};
Self::draw_box(frame, b, center, bounds, theme);
}
// Guided dynamic-input layouts place their editable boxes on the
// construction geometry, so keep the tracking-reference pill near
// the crosshair instead.
// Keep the tracking hint near the crosshair in guided layouts.
if let Some(text) = self.tracking_hint.as_deref() {
let hw = (text.len() as f32 * DYN_CHAR_W) + DYN_PAD * 2.0;
@@ -2636,12 +2634,11 @@ impl DynInputCanvas {
});
x += w + DYN_GAP;
}
// Informational tracking reference, using the same pill style as
// the command prompt. Keep it below the editable value row.
// Place the tracking hint below the value row.
if self.tracking_hint.is_some() {
let mut hy = by + DYN_BOX_H + 3.0;
// If there is no room below, place it above the prompt/value block.
// Move above when bottom space is insufficient.
if hy + DYN_BOX_H > bounds.height {
hy = (py - DYN_BOX_H - 3.0).max(0.0);
}