From 268a4452f9969e9048fd95dd04985b433548ceca Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 12 Oct 2026 16:29:20 +0700 Subject: [PATCH] Part of #1358: the Image Trace section no longer widens the Properties panel Its View row asked for the row's whole width for its menu before its label was laid out, so the row ran past the panel, the panel's content grew and the start of every label was cut off. --- crates/ui-egui/src/panels/image_trace.rs | 28 +++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/image_trace.rs b/crates/ui-egui/src/panels/image_trace.rs index a46d852c..b7bc0613 100644 --- a/crates/ui-egui/src/panels/image_trace.rs +++ b/crates/ui-egui/src/panels/image_trace.rs @@ -114,7 +114,8 @@ fn set_view(app: &mut VectorcraftApp, view: TraceView) { /// The selected Image Trace object's View row (Control bar, Properties). pub(crate) fn view_row(app: &mut VectorcraftApp, ui: &mut Ui, current: TraceView, width: f32) { widgets::dim_label(ui, tl!("View:")); - if let Some(v) = view_dropdown(ui, current, width) { + // No wider than what the label leaves of the row (#1358). + if let Some(v) = view_dropdown(ui, current, width.min(ui.available_width())) { set_view(app, v); } } @@ -419,6 +420,31 @@ mod tests { app } + /// #1358: in Properties the View row fits the panel, so the panel doesn't widen and clip its + /// labels (the row took the panel's whole width for its menu, beside its label). + #[test] + fn the_view_row_fits_the_properties_panel() { + let mut app = traced_app(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + // Where the panel's content ends after a few frames. + let right = |app: &mut VectorcraftApp| { + let mut right = 0.0; + for _ in 0..3 { + let screen = Rect::from_min_size(Pos2::ZERO, vec2(280.0, 700.0)); + let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| { + crate::panels::properties::show(app, ui); + right = ui.min_rect().right(); + }); + out.textures_delta.clear(); + } + right + }; + let traced = right(&mut app); + app.run("select.none", json!({})).unwrap(); + assert_eq!(traced, right(&mut app)); + } + #[test] fn advanced_is_a_section_that_stays_as_it_was_left() { let mut app = traced_app();