From 63375bc84d3ce976ca7b1321f09ab142f85d25f0 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sun, 11 Oct 2026 03:54:51 +0000 Subject: [PATCH] Tools panel: Selection is the filled arrow, Direct Selection the hollow one Fixes #437 --- crates/ui-egui/src/icons.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs index 69415e9b3..7ad0bf3f8 100644 --- a/crates/ui-egui/src/icons.rs +++ b/crates/ui-egui/src/icons.rs @@ -78,8 +78,8 @@ fn arrow(pen: &Pen, hollow: bool) { pub fn paint(p: &Painter, r: Rect, name: &str, c: Color32) { let mut pen = Pen { p, r, c, w: 1.3 }; match name { - "tool-selection" => arrow(&pen, true), - "tool-direct" => arrow(&pen, false), + "tool-selection" => arrow(&pen, false), + "tool-direct" => arrow(&pen, true), "tool-page" => { pen.closed(&[(5.0, 3.0), (12.0, 3.0), (15.0, 6.0), (15.0, 17.0), (5.0, 17.0)]); pen.line(&[(12.0, 3.0), (12.0, 6.0), (15.0, 6.0)]); @@ -842,4 +842,20 @@ mod tests { assert_ne!(drawn[0], drawn[2], "Shear draws like Free Transform"); assert_ne!(drawn[1], drawn[2], "Scale and Shear draw alike"); } + + /// Whether the arrow icon `name` paints is filled, from the fill of its one path shape. + fn arrow_filled(name: &str) -> bool { + let ctx = egui::Context::default(); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| { + paint(ui.painter(), Rect::from_min_size(pos2(0.0, 0.0), vec2(20.0, 20.0)), name, Color32::WHITE); + }); + out.textures_delta.clear(); + out.shapes.iter().any(|s| matches!(&s.shape, Shape::Path(p) if p.fill != Color32::TRANSPARENT)) + } + + #[test] + fn selection_arrow_is_filled_and_direct_selection_hollow() { + assert!(arrow_filled("tool-selection"), "Selection draws a hollow arrow"); + assert!(!arrow_filled("tool-direct"), "Direct Selection draws a filled arrow"); + } }