From 5a7ca767db03ccd5dd0872067d10064e77900463 Mon Sep 17 00:00:00 2001 From: jahala Date: Sat, 10 Oct 2026 06:50:23 +0100 Subject: [PATCH] UI: the Control panel shows its second row (#142) In every workspace that shows the Control panel (Advanced, Typography, Printing and Proofing, Book), the second row of fields was cut off at the panel's lower edge: Y and H in object mode, leading, tracking and the indents in text mode. The panel lays its groups out in a row that centres each child vertically. The two-row grids were placed as if they were one row tall and then grew downward, so they started 13.5 pt below the panel's top instead of at it and ended 5.5 pt past the 59 pt panel. The row is now top-aligned, which is where the font menus, the separators and the reference-point proxy already sat. Co-authored-by: Claude Opus 5.5 (1M context) Co-authored-by: Brandon Thomas --- crates/ui-egui/src/chrome.rs | 2 +- crates/ui-egui/src/lib.rs | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 23876f3a7..4d93517d6 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -164,7 +164,7 @@ pub fn control_bar(app: &mut DesignApp, ui: &mut egui::Ui) { // Wider than the window: the bar scrolls sideways. crate::widgets::overflow_scrolling(ui); egui::ScrollArea::horizontal().id_salt("control_bar_scroll").auto_shrink([false, true]).show(ui, |ui| { - ui.horizontal(|ui| { + ui.horizontal_top(|ui| { let text_mode = matches!(app.session.tool_id(), "type" | "verticalType") || app.session.active().is_some_and(|d| d.selection.text.is_some()); if text_mode { diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 4ec0b8b08..89ffd1a71 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -912,6 +912,30 @@ pub fn drop_key_name_text(raw: &mut egui::RawInput, text_field_focused: bool) { mod tests { use super::*; + /// The Control panel's two-row groups were centred as if they were one row tall, so the second + /// row hung below the panel and was cut off. + #[test] + fn control_bar_shows_its_second_row() { + use egui_kittest::kittest::Queryable as _; + let mut app = DesignApp::new(designcraft_engine::Session::new(), Services::default()); + app.run("file.newSample", json!({})).unwrap(); + app.ui.control_bar = true; + let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1440.0, 900.0)).build_ui_state( + |ui, app: &mut DesignApp| { + let ctx = ui.ctx().clone(); + app.logic(&ctx); + app.ui(ui); + }, + app, + ); + h.run_steps(4); + let bar = egui::containers::panel::PanelState::load(&h.ctx, egui::Id::new("control_bar")).unwrap().outer_rect; + assert!(bar.height() > 40.0, "{bar:?}"); + let rows: Vec = h.query_all_by_label("Y:").map(|n| n.rect()).filter(|r| bar.contains(r.left_top())).collect(); + assert_eq!(rows.len(), 1, "the Y: caption of the Control panel"); + assert!(rows[0].bottom() <= bar.bottom(), "Y: caption {:?} hangs below the Control panel {bar:?}", rows[0]); + } + #[test] fn key_names_sent_as_text_are_dropped() { let text = |t: &str| egui::Event::Text(t.to_string());