Merge pull request #10106 from dotCooCoo/fix/stroke-host-labels

Stroke: Cap, Corner, Align Stroke and Miter Limit line up with the panel rows
This commit is contained in:
.CooCoo authored and GitHub committed 2026-11-29 11:26:16 -08:00
commit 02dd9f3fd0
2 files changed
+11 -3

No files matched your search

+3 -2
View File
@@ -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);
+8 -1
View File
@@ -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:?}");
}