ui-panels: the rail's locate trial is reached by a module, against the rail's Tracked slots and its reveal and mark props

This commit is contained in:
bflatastic
2026-11-23 13:20:49 +07:00
parent b84703ac8b
commit cbf17f41b9
2 changed files with 12 additions and 5 deletions
+11 -5
View File
@@ -2,7 +2,7 @@
//! neither chooses it.
use super::{CUT, REDO, UNDO, tools};
use craft_ui::contract::{Role, Show as _};
use craft_ui::contract::{Role, Tracked};
use craft_ui::display::TargetMark;
use craft_ui::rails::{LastUsed, SlotId, ToolRail, ToolSlot};
use craft_ui::testing::{Fixture, trial};
@@ -20,11 +20,17 @@ fn rig(reveal: Option<u8>, mark: Option<u8>) -> Rig {
let selected = Rc::new(RefCell::new(Vec::new()));
let flyout = Rc::new(Cell::new(None));
let (seen, opened) = (selected.clone(), flyout.clone());
let slots = Tracked::new(vec![ToolSlot::new(0, tools(&[UNDO, REDO, CUT]))]);
let last = Tracked::new(LastUsed::default());
let mut fixture = Fixture::new(move |ui| {
let slots = [ToolSlot::new(0, tools(&[UNDO, REDO, CUT]))];
let last = LastUsed::default();
let current = UNDO;
let out = ToolRail::new("Tools", &slots, &current, &last).reveal(reveal.as_ref()).mark(mark.as_ref()).show_rail(ui, |_, _| {});
let mut rail = ToolRail::new("Tools", &slots, &UNDO, &last);
if let Some(tool) = &reveal {
rail = rail.reveal(tool);
}
if let Some(tool) = &mark {
rail = rail.mark(tool);
}
let out = rail.show_rail(ui, |_, _| {});
if let Some(tool) = out.select {
seen.borrow_mut().push(tool);
}
+1
View File
@@ -2,6 +2,7 @@
//! click, a press dragged away, the flyout's tear-off bar and the window a torn-off group floats in.
pub(crate) mod drawer;
pub(crate) mod locate;
use craft_behavior::{GesturePhase, Mixed};
use craft_ui::contract::overlay::{PlacementChange, PlacementKind};