Merge pull request #10099 from dotCooCoo/fix/rail-footer-divider

Tools: the rail shows one rule above the controls under the tools
This commit is contained in:
.CooCoo authored and GitHub committed 2026-11-29 11:25:27 -08:00
commit 3b90e54a61
2 files changed
+14 -11

No files matched your search

+2 -2
View File
@@ -768,11 +768,11 @@ fn quad_bounds(quad: &[Point; 4]) -> vectorcraft_geom::Rect {
/// The Fill/Stroke proxy, Color/Gradient/None, the drawing modes and screen mode under the rail's
/// tools: in two columns the three drawing modes show, in one only the current one, which cycles
/// them. A row the rail is too narrow for goes on in the next line. The All Tools drawer's Show
/// section hides any of them. A rule above them parts them from the tools, which scroll above it in a short rail.
/// section hides any of them. The rail's footer region draws the rule that parts them from the tools, which scroll
/// above it in a short rail.
fn bottom_controls(app: &mut VectorcraftApp, ui: &mut Ui, footer: RailFooter) {
let two = footer.columns > 1;
let show = app.ui.toolbar_show;
Divider::horizontal().show(ui);
if show.fill_stroke {
crate::panels::proxy(app, ui);
}
+12 -9
View File
@@ -306,9 +306,9 @@ fn the_paint_and_drawing_mode_buttons_fit_the_toolbar_width() {
assert_eq!(app.session.draw_mode, vectorcraft_engine::DrawMode::Behind);
}
/// In one column the Color, Gradient and None chips share one line, and a rule across the rail parts the controls under
/// the tools from the tools, which scroll above them in a short rail: it lies between the last tool and Fill and
/// Stroke.
/// In one column the Color, Gradient and None chips share one line, and one rule across the rail parts the controls
/// under the tools from the tools, which scroll above them in a short rail: it lies between the last tool and Fill and
/// Stroke, and no second rule doubles it.
#[test]
fn the_controls_under_the_tools_share_a_line_under_a_rule() {
let mut app = app_with(200, 200);
@@ -325,12 +325,15 @@ fn the_controls_under_the_tools_share_a_line_under_a_rule() {
// A rule is a thin horizontal line or bar across most of the rail's width, between the tools and the controls.
let between = |y: f32| y > last.bottom() && y < proxy.top();
let across = |left: f32, right: f32| right - left >= last.width() * 0.75 && left < last.right() && right > last.left();
let ruled = flat.iter().any(|shape| match shape {
egui::Shape::LineSegment { points: [a, b], .. } => (a.y - b.y).abs() < 0.5 && between(a.y) && across(a.x.min(b.x), a.x.max(b.x)),
egui::Shape::Rect(r) => r.rect.height() <= 2.0 && between(r.rect.center().y) && across(r.rect.left(), r.rect.right()),
_ => false,
});
assert!(ruled, "a rule lies between the last tool {last:?} and Fill and Stroke {proxy:?}");
let rules = flat
.iter()
.filter(|shape| match shape {
egui::Shape::LineSegment { points: [a, b], .. } => (a.y - b.y).abs() < 0.5 && between(a.y) && across(a.x.min(b.x), a.x.max(b.x)),
egui::Shape::Rect(r) => r.rect.height() <= 2.0 && between(r.rect.center().y) && across(r.rect.left(), r.rect.right()),
_ => false,
})
.count();
assert_eq!(rules, 1, "one rule lies between the last tool {last:?} and Fill and Stroke {proxy:?}");
}
/// A screen reader reads the drawing-mode buttons' state as the rail shows it, in every mode: in two columns the