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