diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index b109ca486b..e1b48cb9c4 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -611,7 +611,7 @@ pub fn accepts_field(d: &Dialog, field: &str) -> bool { /// A Graph Data Column Width set this way sets every column, as Cell Style's does. An Import PDF /// `allPages` set this way to the other pick sets Import PDF pages as links back to its default. /// A Dimension Tool Options `arrowStyle` set this way clears `arrowHead`, and a built-in -/// `arrowHead` set this way sets the `arrowStyle` of its Arrow Style entry, as that menu does. +/// `arrowHead` set this way sets both values of its Arrow Style entry, as that menu does. pub fn set_field(d: &mut Dialog, field: String, value: Value) { if d.kind == brush_options::KIND { brush_art_options::note_set(d, &field); @@ -625,8 +625,8 @@ pub fn set_field(d: &mut Dialog, field: String, value: Value) { if d.kind == import_pdf::KIND { import_pdf::note_set(d, &field, &value); } - if d.kind == dimension::KIND { - dimension::note_set(d, &field, &value); + if d.kind == dimension::KIND && dimension::note_set(d, &field, &value) { + return; } if d.kind == "preferences" { crate::prefs_dialog::note_set(d, &field, &value); diff --git a/crates/ui-egui/src/dialogs/dimension.rs b/crates/ui-egui/src/dialogs/dimension.rs index 00a06c90fd..8eab0be40b 100644 --- a/crates/ui-egui/src/dialogs/dimension.rs +++ b/crates/ui-egui/src/dialogs/dimension.rs @@ -77,22 +77,27 @@ pub fn open(app: &mut VectorcraftApp) -> Result { } /// For `ui.dialog.set`, as the Arrow Style menu sets them: an `arrowStyle` set alone draws that -/// style's own head, and a built-in head set as `arrowHead` takes the arrow style of its Arrow -/// Style entry (`tick` for `Slash`, `filled` for `Barbed`). -pub(super) fn note_set(d: &mut Dialog, field: &str, value: &Value) { +/// style's own head, and a built-in head set as `arrowHead` sets both values of its Arrow Style +/// entry (`tick` with no `arrowHead` for `Slash`, `filled` with `Barbed` for `Barbed`). Returns +/// whether it set the field itself. +pub(super) fn note_set(d: &mut Dialog, field: &str, value: &Value) -> bool { match field { "arrowStyle" => { d.fields.insert("arrowHead".into(), Value::Null); + false } "arrowHead" => { let head = built_in_head(value); if let Some(ch) = arrow_choices().into_iter().find(|ch| head.is_some() && ch.drawn() == head) - && let Ok(style) = serde_json::to_value(ch.style) + && let (Ok(style), Ok(head)) = (serde_json::to_value(ch.style), serde_json::to_value(&ch.head)) { d.fields.insert("arrowStyle".into(), style); + d.fields.insert("arrowHead".into(), head); + return true; } + false } - _ => {} + _ => false, } } @@ -473,11 +478,11 @@ mod tests { super::super::confirm(&mut app).unwrap(); let style = serde_json::from_value::(app.session.tool_options_of("dimension")["style"].clone()).unwrap(); assert_eq!((style.arrow_style, style.arrowhead()), (ArrowStyle::Filled, Some(Arrowhead::Barbed))); - // The head of an older style takes that style, as its menu entry does. + // The head of an older style sets that style and no `arrowHead`, as its menu entry does. open(&mut app).unwrap(); let d = app.ui.dialog.as_mut().unwrap(); super::super::set_field(d, "arrowHead".into(), json!("Slash")); - assert_eq!(d.fields["arrowStyle"], "tick"); + assert_eq!((&d.fields["arrowStyle"], &d.fields["arrowHead"]), (&json!("tick"), &Value::Null)); } /// A selected dimension shows its style in Properties, with Apply to All and Set as Default. diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 6e3a18afb1..9c7335b9bb 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -457,6 +457,7 @@ antiAlias Sharp Nítid Bar Graph Tool Eina de gràfic de barres Barbed Amb pues arrowhead Feather Ploma +arrowhead Target Diana Bas Relief Baix relleu Bas Relief… Baix relleu… Base Along: Base al llarg de: diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 33f95be895..3f078d6084 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -6227,6 +6227,7 @@ effect Regular Regular Arrow (open) Flecha (abierta) Barbed Con púas arrowhead Feather Emplumado +arrowhead Target Diana Half Arrow (left) Media flecha (izquierda) Half Arrow (right) Media flecha (derecha) Concave Cóncava diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 732efa4a98..6771d4043d 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -410,6 +410,7 @@ font-technology Variable Változó Bar Graph Tool Sávdiagram Barbed Szakállas arrowhead Feather Tollazat +arrowhead Target Céltábla Baseline Alapvonal Baseline (Standard) Alapvonali (szabványos) Baseline Optimized Alapvonali, optimalizált diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 108b682ab2..545ace87ff 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7409,6 +7409,7 @@ anchor Points: Punti: Arrow (open) Freccia (aperta) Barbed Uncinata arrowhead Feather Piuma +arrowhead Target Bersaglio Half Arrow (left) Mezza freccia (sinistra) Half Arrow (right) Mezza freccia (destra) Double Bar Doppia barra diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index f622d20def..c2f8f160ec 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7381,6 +7381,7 @@ anchor Points: 포인트: Arrow (open) 화살표 (윤곽) Barbed 미늘 arrowhead Feather 깃털 +arrowhead Target 과녁 Half Arrow (left) 반쪽 화살표 (왼쪽) Half Arrow (right) 반쪽 화살표 (오른쪽) Double Bar 이중 막대 diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index db35beb9ad..173b5308d3 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7358,6 +7358,7 @@ axis Y Axis Ось Y Bar Черта Barbed С зазубриной arrowhead Feather Перо +arrowhead Target Мишень Baseline (Standard) Базовый (стандартный) Baseline Optimized Базовый оптимизированный Bicubic Бикубическая diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index bb31ef765d..be64866a45 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -681,6 +681,9 @@ fn built_in_arrowhead_names_are_in_complete_catalogs() { use vectorcraft_doc::Arrowhead; let names = distinct(Arrowhead::ALL.iter().map(|h| h.label().to_string()).collect()); assert_eq!(names.len(), 41, "{names:?}"); + // Spanish's plain Target row names a destination; its arrowhead row names the shape. + let es = crate::i18n::Lang::from_code("es").expect("es registered"); + assert_eq!(crate::i18n::tr_ctx(es, "arrowhead", "Target"), "Diana"); let bad = lacking(&names, |c, n| c.contextual("arrowhead", n).is_some() || (n != "Feather" && c.plain(n).is_some())); assert!(bad.is_empty(), "{}", bad.join("\n")); } diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 916d1e2609..2bdc31cdff 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7391,6 +7391,7 @@ anchor Points: Точки: Arrow (open) Стрілка (контурна) Barbed Зазубрена arrowhead Feather Оперення +arrowhead Target Мішень Half Arrow (left) Половина стрілки (ліворуч) Half Arrow (right) Половина стрілки (праворуч) Double Bar Подвійна смуга