diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 7c73ca98..7066a30f 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -95,7 +95,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let t = Tokens::get(ui.ctx()); // The user's choice alone: a window too short for the tools scrolls them. let cols = if app.ui.toolbar_double { 2 } else { 1 }; - let w = if cols == 2 { 76.0 } else { WIDTH }; + // Two 36 pt buttons with 2 pt either side inside the border and separator line (at 76 they + // overran the right border). + let w = if cols == 2 { 80.0 } else { WIDTH }; // Where the panel docks: along the window's left edge, under the bars. let edge = ui.available_rect_before_wrap(); ui.ctx().data_mut(|d| d.insert_temp(crate::floating::tools_zone_id(), egui::Rect::from_min_size(edge.min, vec2(WIDTH, edge.height())))); @@ -199,11 +201,10 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, cols: usize, floating: Option 40.0) + .map(|w| w.rect) + .next() + }); + let hdr = hdr.unwrap(); + let first = tools[0]; + let row_right = tools.iter().filter(|r| r.top() == first.top()).map(|r| r.right()).fold(first.right(), f32::max); + assert_eq!(row_right - hdr.center().x, hdr.center().x - first.left(), "double {double}, floating {floating:?}: {first:?} in {hdr:?}"); + assert!(first.left() >= hdr.left() && row_right <= hdr.right(), "double {double}, floating {floating:?}: {first:?} in {hdr:?}"); + } + } + /// #812: double-clicking the Artboard tool opens Artboard Options of the active artboard, a /// graph tool Graph Type for the selected graph, and the Magic Wand tool its panel. #[test]