diff --git a/crates/ui-egui/src/panels/stroke.rs b/crates/ui-egui/src/panels/stroke.rs index 7ea1db6e49..7f71d73da4 100644 --- a/crates/ui-egui/src/panels/stroke.rs +++ b/crates/ui-egui/src/panels/stroke.rs @@ -377,7 +377,7 @@ pub(crate) fn link_field(app: &mut VectorcraftApp, ui: &mut Ui, label: &'static } /// The Stroke panel: the weight, the stroke editor (cap, corner, align, dashes), arrowheads, scale, align and the -/// width profile. The panel's own rows share one label column, so their controls start at one x. +/// width profile. The panel's rows and the editor's rows share one label column, so their controls start at one x. pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { use craft::ui::runtime::env::{WordRows, WordsOverride, with_env}; @@ -411,7 +411,8 @@ fn rows(app: &mut VectorcraftApp, ui: &mut Ui) { let editor = StrokeEditor::new(tl!("Stroke"), Bind::given(style.clone())) .sections(StrokeSections::PANEL | StrokeSections::DASH_ALIGN) .closed(mixed.can_align) - .mixed(&mixed_of(&mixed)); + .mixed(&mixed_of(&mixed)) + .host_labels(true); let output = editor.show(ui); if let (Some(new), Some(field)) = (output.events.landed(), output.field) { apply_style(app, &style, new.clone(), field); diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index 8aca326b47..66cf954339 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -28,9 +28,16 @@ fn turning_dashes_on_fits_them_to_corners_and_turning_back_on_restores_the_last_ #[test] fn the_panel_rows_start_their_controls_at_one_x() { let mut panel = Panel::new(app_with_rect(), stroke::show); + // Dashes show the Dash offset row. + run(&mut panel.app(), "stroke.set", json!({"dash": [4, 2]})); panel.frame(); panel.frame(); - let starts: Vec<(&str, f32)> = ["Weight", "Start arrowhead", "Profile"].into_iter().map(|name| (name, panel.rect(name).min.x)).collect(); + let names = ["Weight", "Miter limit", "Dash offset", "Start arrowhead", "Profile"]; + let mut starts: Vec<(&str, f32)> = names.into_iter().map(|name| (name, panel.rect(name).min.x)).collect(); + // The label text of the editor's button rows has the same names as their button groups. + for name in ["Alignment", "Caps", "Corners"] { + starts.push((name, panel.rect_role(name, craft::ui::contract::Role::RADIO_GROUP).min.x)); + } let first = starts[0].1; assert!(starts.iter().all(|(_, x)| (x - first).abs() < 0.5), "controls start at {starts:?}"); }