mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
G1: Measure tool honors Measurement Labels preference
Hide the preview line and readout when Smart Guides › Measurement Labels is off; options still report the last drag. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
bflatastic
co-authored by
Cursor
parent
fd53416de3
commit
6ef9f2dd93
@@ -53,6 +53,9 @@ impl Tool for MeasureTool {
|
||||
}
|
||||
|
||||
fn overlays(&self, cx: &ToolContext) -> Vec<Overlay> {
|
||||
if !cx.measurement_labels {
|
||||
return vec![];
|
||||
}
|
||||
let Some((a, b)) = self.line else { return vec![] };
|
||||
if a == b {
|
||||
return vec![];
|
||||
@@ -104,5 +107,7 @@ mod tests {
|
||||
assert!((o["angle"].as_f64().unwrap() - 53.130102).abs() < 1e-4);
|
||||
let ov = t.overlays(&cx);
|
||||
assert!(matches!(&ov[1], Overlay::Measure { text, .. } if text.starts_with("D: 50.00 pt")));
|
||||
let quiet = ToolContext { measurement_labels: false, ..cx };
|
||||
assert!(t.overlays(&quiet).is_empty(), "Measurement Labels off hides the readout");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user