From 58eff9647bda71ced3ea90c3a00ffe737e7b9244 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 10:00:15 +0100 Subject: [PATCH 01/15] Docking: DockConfig::menu_button shows the panel menu button on every group, with the dock's rows when the host has none --- crates/ui-panels/src/docking/config.rs | 12 ++++++ crates/ui-patterns/src/patterns/dock/area.rs | 2 +- .../tests/it/docking/panel_menu.rs | 37 +++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index 5256837eb..be83a96f3 100644 --- a/crates/ui-panels/src/docking/config.rs +++ b/crates/ui-panels/src/docking/config.rs @@ -84,6 +84,10 @@ pub struct DockConfig { pub native_windows: bool, /// Docked groups' menus get Minimize and Move Group Up and Down. pub group_order_items: bool, + /// Every group shows the panel menu button at the end of its tab strip, listing the dock's rows when the host has + /// none for its panel. Off: only a group whose shown panel has host rows (`DockPanels::panel_rows`) shows the + /// button, and the dock's rows open from a context request on a tab. + pub menu_button: bool, } impl Default for DockConfig { @@ -102,11 +106,19 @@ impl Default for DockConfig { wheel_selects_tabs: false, native_windows: true, group_order_items: false, + menu_button: false, } } } impl DockConfig { + /// The panel menu button on every group on or off. + #[must_use] + pub fn menu_button(mut self, on: bool) -> Self { + self.menu_button = on; + self + } + /// The Minimize and Move Group Up and Down items of docked groups' menus on or off. #[must_use] pub fn group_order_items(mut self, on: bool) -> Self { diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 292203268..20ae7a779 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -997,7 +997,7 @@ impl Pass<'_, P> { .zones(scene.config.zone_rule()) .movable(scene.permissions(shown).movable) .menu(move || panel_menu_rows(scene, &mut **panels.borrow_mut(), words, shown).0) - .panel_menu_shown(*hosted) + .panel_menu_shown(*hosted || scene.config.menu_button) .command_states(states.clone()); if look.in_window { group = group.in_window(); diff --git a/crates/ui-patterns/tests/it/docking/panel_menu.rs b/crates/ui-patterns/tests/it/docking/panel_menu.rs index b3b76895e..84904f40a 100644 --- a/crates/ui-patterns/tests/it/docking/panel_menu.rs +++ b/crates/ui-patterns/tests/it/docking/panel_menu.rs @@ -147,3 +147,40 @@ fn a_window_floated_after_an_undo_takes_a_new_id() { assert_eq!(ids.len(), 1, "Float made a window again"); assert_ne!(ids, undone, "the window after the undo does not take the undone window's id"); } + +/// Panels with no host rows. +struct Bare; + +impl DockPanels for Bare { + fn body(&mut self, _: &usize, _: &mut Ui, _: &mut BodyCx<'_>) {} +} + +/// With `DockConfig::menu_button`, a group whose panel has no host rows still shows the panel menu button, and its +/// menu lists the dock's rows; without it the group shows none. +#[trial] +fn the_menu_button_config_shows_the_panel_menu_without_host_rows() { + for on in [false, true] { + let root = Node::split(Axis::X, SplitSize::Ratio(0.5), Node::tabs(vec![0, 1], 0), Node::tabs(vec![2], 0)); + let workspace = Rc::new(RefCell::new(Arc::new(Workspace::new(Layout::new(Some(root), Vec::new()))))); + let (held, specs) = (Rc::clone(&workspace), Tracked::new(Specs)); + let mut fixture = Fixture::new(move |ui| { + let mut shown = held.borrow().clone(); + DockArea::new("Dock", Bind::bound(&mut shown), &specs, &mut Bare, DockConfig::default().menu_button(on)).show(ui); + *held.borrow_mut() = shown; + }); + fixture.room(Vec2::new(1200.0, 600.0)).settle(); + let buttons: Vec<_> = + fixture.by_role(Role::BUTTON).into_iter().filter(|button| fixture.tree().name_of(button.node) == Some("Panel Menu")).collect(); + if !on { + assert!(buttons.is_empty(), "without host rows and without the config, no group shows the button"); + continue; + } + assert_eq!(buttons.len(), 2, "each group shows its panel menu button"); + fixture.click(&buttons[1]).idle(2); + let float = fixture.by_label("Float").expect("the menu lists the dock's Float row"); + fixture.click(&float).idle(2); + let shown = workspace.borrow(); + let floated: Vec = shown.layout().floating.iter().flat_map(|window| window.panels().copied().collect::>()).collect(); + assert_eq!(floated, vec![2], "the dock's row runs for the group whose button opened the menu"); + } +} From eff9f6b27846183703fd0568a33fa6327f711667 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 11:21:21 +0100 Subject: [PATCH 02/15] Docking: DockConfig::flyout_outside_closes, so an iconic column's flyout can stay open on a press outside unless Auto-Collapse is on --- crates/ui-panels/src/docking/config.rs | 12 ++++++ crates/ui-panels/src/docking/event.rs | 4 +- crates/ui-panels/src/docking/flyout.rs | 30 +++++++++++--- crates/ui-panels/src/docking/iconic.rs | 12 ++++-- crates/ui-panels/src/docking/iconic/trials.rs | 39 +++++++++++++++++++ crates/ui-patterns/src/patterns/dock/area.rs | 3 +- 6 files changed, 88 insertions(+), 12 deletions(-) diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index be83a96f3..6532a7e05 100644 --- a/crates/ui-panels/src/docking/config.rs +++ b/crates/ui-panels/src/docking/config.rs @@ -88,6 +88,10 @@ pub struct DockConfig { /// none for its panel. Off: only a group whose shown panel has host rows (`DockPanels::panel_rows`) shows the /// button, and the dock's rows open from a context request on a tab. pub menu_button: bool, + /// A press outside an iconic column's open flyout closes it. Off, the flyout stays open while the person works + /// elsewhere, until Escape, its icon or, with Auto-Collapse Iconic Panels, a press outside or the focus leaving it + /// closes it. + pub flyout_outside_closes: bool, } impl Default for DockConfig { @@ -107,6 +111,7 @@ impl Default for DockConfig { native_windows: true, group_order_items: false, menu_button: false, + flyout_outside_closes: true, } } } @@ -119,6 +124,13 @@ impl DockConfig { self } + /// Whether a press outside an iconic column's open flyout closes it. + #[must_use] + pub fn flyout_outside_closes(mut self, on: bool) -> Self { + self.flyout_outside_closes = on; + self + } + /// The Minimize and Move Group Up and Down items of docked groups' menus on or off. #[must_use] pub fn group_order_items(mut self, on: bool) -> Self { diff --git a/crates/ui-panels/src/docking/event.rs b/crates/ui-panels/src/docking/event.rs index d0adf5976..59a841227 100644 --- a/crates/ui-panels/src/docking/event.rs +++ b/crates/ui-panels/src/docking/event.rs @@ -18,8 +18,8 @@ pub enum DockEvent

{ }, /// Auto-Collapse Iconic Panels was chosen in a column menu. The host flips its preference and passes it back. ToggleAutoCollapse, - /// The area opened, switched or closed its flyout: an icon click, Escape, a press outside, or the focus - /// leaving it under Auto-Collapse. A host that binds the flyout takes it as the request when its binding is given. + /// The area opened, switched or closed its flyout: an icon click, Escape, a press outside (unless + /// `DockConfig::flyout_outside_closes` is off), or a press outside or the focus leaving it under Auto-Collapse. A host that binds the flyout takes it as the request when its binding is given. FlyoutChanged { /// The panel now in the flyout; `None` when it closed. panel: Option

, diff --git a/crates/ui-panels/src/docking/flyout.rs b/crates/ui-panels/src/docking/flyout.rs index a17f91b56..076999ced 100644 --- a/crates/ui-panels/src/docking/flyout.rs +++ b/crates/ui-panels/src/docking/flyout.rs @@ -1,6 +1,6 @@ //! `Flyout`: the panel an icon of an iconic column opens beside the column. -use crate::contract::overlay::{Anchor, Dismiss, FloatPlace, Place, PlacementChange, ResizeEdges}; +use crate::contract::overlay::{Anchor, Dismiss, FloatPlace, Outside, Place, PlacementChange, ResizeEdges}; use crate::contract::{ BodyCx, Common, Component, Container, ContainerProps, Cx, Mount, NoValue, Outcome, Overlay, OverlayUi, Pad, PopupHandle, Role, SizeLimits, Sizing, }; @@ -48,8 +48,9 @@ impl Outcome for FlyoutOutput { } } -/// A popup beside an iconic column, on the side of the canvas, whose top left the caller places. Escape and a press -/// outside close it; with Auto-Collapse Iconic Panels the focus leaving it closes it too. Its body is measured at the +/// A popup beside an iconic column, on the side of the canvas, whose top left the caller places. Escape closes it, and +/// a press outside it unless [`outside_closes`](Flyout::outside_closes) is off; with Auto-Collapse Iconic Panels a +/// press outside and the focus leaving it close it too. Its body is measured at the /// flyout's width first: the flyout is as tall as the body measures within the room below its top, and at least its /// `size`'s height, and the body then shows in the rect that takes. /// @@ -72,6 +73,11 @@ pub struct Flyout { /// The least size a resize leaves the flyout. #[prop(quantity = "least room a resize leaves, from the dock's measured sizes, in points")] least: Vec2, + /// Whether a press outside closes the flyout. Off, only Escape, the column's icons and, with Auto-Collapse Iconic + /// Panels, a press outside and the focus leaving it close it: work on the canvas leaves it open, as an application + /// whose flyouts stay open until the person closes them wants. + #[prop] + outside_closes: bool, placed: Option, } @@ -80,7 +86,17 @@ impl Flyout { /// `Side::End`), closing when the focus leaves it if `auto_collapse`. pub fn new(opens: Side, size: Vec2, auto_collapse: bool) -> Self { let props = ContainerProps::new().surface(SurfaceKind::Popup).pad(Pad::None).sizing(Sizing::Content); - Flyout { common: Common::new(), props, opens, size, auto_collapse, within: Rect::EVERYTHING, least: Vec2::ZERO, placed: None } + Flyout { + common: Common::new(), + props, + opens, + size, + auto_collapse, + within: Rect::EVERYTHING, + least: Vec2::ZERO, + outside_closes: true, + placed: None, + } } /// The layer the flyout shows in, its top left at `top_left`: placed by the caller, resizable on every edge but @@ -96,7 +112,11 @@ impl Flyout { .placed_at(top_left) .size_limits(SizeLimits::at_least(least)) .resize_edges(free.union(ResizeEdges::TOP).union(ResizeEdges::BOTTOM)) - .dismiss(Dismiss::new().focus_left(self.auto_collapse)) + .dismiss(Dismiss::new().focus_left(self.auto_collapse).outside(if self.outside_closes || self.auto_collapse { + Outside::Close + } else { + Outside::Keep + })) .body_scroll(false); if bounded { overlay.bounds(self.within) } else { overlay } } diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 9a602d4e5..df14cc1f6 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -154,8 +154,8 @@ pub struct IconicColumnStyle { /// opens the flyout of its panel beside the column, switches it to that panel or closes it; one flyout is open at a /// time. A drag of an icon starts a move of its panel, a drag of the grip on top of a group a move of the group, a /// drag of the bar beside its button a move of the column; each starts through the drag session, and a press outside -/// the flyout closes it. Escape and a press -/// outside close the flyout; with `auto_collapse` the focus leaving it does too. +/// the flyout closes it unless `outside_closes` is off. Escape closes the flyout; with `auto_collapse` a press outside +/// and the focus leaving it do too. /// /// The open flyout is the bound `Option

` of [`new`](IconicColumn::new), owned by the host like the layout: a click /// on an icon, Escape and auto-collapse write it, and the host opens a panel (the Window menu) by writing it. The @@ -193,6 +193,9 @@ pub struct IconicColumn<'a, P: Value + Hash + 'static> { /// Whether Auto-Collapse Iconic Panels is on. #[prop] auto_collapse: bool, + /// Whether a press outside the open flyout closes it ([`Flyout::outside_closes`]); on by default. + #[prop] + outside_closes: bool, /// The rect the dock may grow within, which bounds how wide its inner edge can make the column, and the rect its /// flyouts open in. Unset, the flyouts take the room layers opened there have (`overlay::layer_room`): around a /// palette window, the work area. @@ -253,6 +256,7 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { opens: Side::End, bar: ColumnBar::Own, auto_collapse: false, + outside_closes: true, within: Rect::NOTHING, open, view: None, @@ -598,7 +602,7 @@ impl Component for IconicColumn<'_, P> { fn overlay(&mut self, ui: &mut OverlayUi<'_>, cx: &mut Cx<'_, Self>) { let popup = cx.popup("flyout"); let sizes = cx.style.sizes.column; - let (opens, auto_collapse, column) = (self.opens, self.auto_collapse, cx.rect); + let (opens, auto_collapse, outside_closes, column) = (self.opens, self.auto_collapse, self.outside_closes, cx.rect); // The screen side the flyouts open on, mirrored in a right-to-left layout. let right = (opens == Side::End) != cx.flow.is_rtl(); let within = if self.within.is_positive() { self.within } else { crate::contract::overlay::layer_room(&cx.core.ctx) }; @@ -616,7 +620,7 @@ impl Component for IconicColumn<'_, P> { let mut resized = None; for (at, plan) in plans.into_iter().enumerate() { let Some(FlyoutPlan { group, top_left, size, fixed, icons_top }) = plan else { continue }; - let shown = Flyout::new(opens, size, auto_collapse).within(bounds).least(least).show_popup( + let shown = Flyout::new(opens, size, auto_collapse).within(bounds).least(least).outside_closes(outside_closes).show_popup( ui, popup.at(at), Anchor::Point(top_left), diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index 88c8f7fc3..f93a7fb2d 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -557,3 +557,42 @@ fn a_themes_grip_shape_reaches_the_grips() { assert!(marks.windows(2).all(|w| (w[1].min.x - w[0].max.x - 3.0).abs() < 0.01), "three points apart: {marks:?}"); assert_ne!(ink, egui::Color32::TRANSPARENT); } + +/// An iconic column at the start of a wide room, its flyout's outside rule `outside_closes` and Auto-Collapse +/// `auto_collapse`, and the panel whose flyout is open. +fn outside_column(outside_closes: bool, auto_collapse: bool) -> (Fixture, Rc>>) { + let open = Rc::new(Cell::new(None)); + let seen = Rc::clone(&open); + let mut fixture = Fixture::new(move |ui| { + let column = Column::new(vec![Group::new(vec![0, 1], 0)]); + let mut now = seen.get(); + let (rail, _) = ui.max_rect().split_left_right_at_x(ui.max_rect().left() + RAIL); + IconicColumn::new("Panels", global("iconic column", "outside"), &column, Bind::bound(&mut now), &spec) + .outside_closes(outside_closes) + .auto_collapse(auto_collapse) + .within(screen()) + .show_flyouts_at(ui, rail, |_, at, ui, _| { + let GroupAt::Show(rect) = at else { return None }; + Panel::new("Flyout").show_at(ui, rect, |_, _| ()); + None + }); + seen.set(now); + }); + fixture.room(SCREEN).settle(); + (fixture, open) +} + +/// A press outside the open flyout closes it by default; with `outside_closes` off it stays open, unless Auto-Collapse +/// Iconic Panels is on, which closes it there as before. +#[trial] +fn a_press_outside_closes_the_flyout_only_where_outside_closes_or_auto_collapse_is_on() { + for (outside_closes, auto_collapse, stays) in [(true, false, false), (false, false, true), (false, true, false)] { + let (mut fixture, open) = outside_column(outside_closes, auto_collapse); + let icon = fixture.by_label("Swatches").expect("the Swatches icon"); + fixture.click(&icon).idle(3); + assert_eq!(open.get(), Some(1), "a click on the icon opens its flyout"); + fixture.click_at(Pos2::new(SCREEN.x - 20.0, SCREEN.y - 20.0)).idle(3); + let expected = if stays { Some(1) } else { None }; + assert_eq!(open.get(), expected, "outside_closes {outside_closes}, auto_collapse {auto_collapse}: a press outside"); + } +} diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 20ae7a779..065f078eb 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -1227,7 +1227,8 @@ impl Pass<'_, P> { .opens(opens) .bar(bar) .within(within) - .auto_collapse(scene.auto_collapse); + .auto_collapse(scene.auto_collapse) + .outside_closes(scene.config.flyout_outside_closes); let output = shown.show_flyouts_at(ui, cell, |group, at, ui, body| self.group_of(ui, body, group, at, in_window)); self.report.flyout.extend(output.edit.events); ColumnWork { iconic: output.iconic, picked: output.picked, resized: Vec::new(), width: output.width, flyout: output.flyout } From df644e9debc1174ac1b9a0be95fa9057845ada5f Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 13:25:54 +0100 Subject: [PATCH 03/15] Keep a flyout taller than the room below its icons inside the bounds A flyout whose body measures taller than the room below its top now moves up within the bounds instead of being cut to that room, so its body no longer lays out below the window. Only a body taller than the bounds scrolls. --- crates/ui-panels/src/docking/flyout.rs | 12 ++-- crates/ui-panels/src/docking/iconic/trials.rs | 57 +++++++++++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/crates/ui-panels/src/docking/flyout.rs b/crates/ui-panels/src/docking/flyout.rs index 076999ced..65b4d9e1d 100644 --- a/crates/ui-panels/src/docking/flyout.rs +++ b/crates/ui-panels/src/docking/flyout.rs @@ -50,9 +50,10 @@ impl Outcome for FlyoutOutput { /// A popup beside an iconic column, on the side of the canvas, whose top left the caller places. Escape closes it, and /// a press outside it unless [`outside_closes`](Flyout::outside_closes) is off; with Auto-Collapse Iconic Panels a -/// press outside and the focus leaving it close it too. Its body is measured at the -/// flyout's width first: the flyout is as tall as the body measures within the room below its top, and at least its -/// `size`'s height, and the body then shows in the rect that takes. +/// press outside and the focus leaving it close it too. Its body is measured at the flyout's width first: the flyout is +/// as tall as the body measures, at most the height of `within`, and at least its `size`'s height, and the body then +/// shows in the rect that takes. A flyout taller than the room below its top moves up to stay inside `within` (the +/// layer keeps inside its bounds) and scrolls only when it is taller than `within`. /// /// The user resizes it by its top and bottom edges, the edge away from the column and the two corners there; the /// column side stays. The flyout keeps no rect of its own: each step comes back in [`FlyoutShown::placed`] and the @@ -140,8 +141,9 @@ impl Flyout { } }; let size = self.size; - // A body measures no taller than the room below the top, inside the bounds. - let room = (self.within.bottom() - top_left.y).max(size.y); + // A body measures no taller than the bounds: a flyout that does not fit below its top moves up, so only a body + // taller than the bounds is limited to them. + let room = self.within.height().max(size.y); let overlay = self.overlay(top_left, ui.is_rtl()); self.props = self.props.mount(Mount::Layer(overlay)); let shown = ui.show_container(popup, self, |ui, cx| { diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index f93a7fb2d..573ad0463 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -345,6 +345,63 @@ fn a_flyout_with_an_offset_in_a_short_viewport_stays_inside_and_resizes_its_widt } } +/// The names of the panels of the tall-body trial, which sets no heights. +const TALL: [&str; 8] = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight"]; +/// What the body of a flyout in the tall-body trial measures. +const TALL_BODY: f32 = 300.0; + +/// A flyout whose body measures taller than the room below its group's icons moves up to stay inside the bounds, as +/// tall as the body (or as the bounds when those are shorter): it is not cut to the room below its top with the rest +/// of its body laid out below the bounds. The panels set no heights, so the group's height does not give the room. +#[trial] +fn a_flyout_taller_than_the_room_below_its_icons_moves_up_inside_the_bounds() { + let (within, open, shown) = (Rc::new(Cell::new(screen())), Rc::new(Cell::new(None)), Rc::new(Cell::new(None))); + let (bounds, now, seen) = (Rc::clone(&within), Rc::clone(&open), Rc::clone(&shown)); + let mut column = Column::new((0..TALL.len() as u8).map(|panel| Group::new(vec![panel], 0)).collect()); + column.iconic = true; + let mut fixture = Fixture::new(move |ui| { + let current = now.get(); + let mut opened = current; + IconicColumn::new("Panels", global("iconic column", "tall flyouts"), &column, Bind::bound(&mut opened), &|panel: &u8| { + PanelSpec::new(TALL[usize::from(*panel) % TALL.len()]) + }) + .edge(DockEdge::Start) + .opens(Side::End) + .within(bounds.get()) + .show_flyouts_at(ui, Rect::from_min_size(Pos2::ZERO, Vec2::new(RAIL, SCREEN.y)), |group, at, ui, _| { + match at { + GroupAt::Measure(_) => return Some(TALL_BODY), + GroupAt::Show(rect) => { + if group.active_panel().is_some_and(|panel| Some(*panel) == current) { + seen.set(Some(rect)); + } + Panel::new("Flyout").show_at(ui, rect, |_, _| ()); + } + } + None + }); + now.set(opened); + }); + fixture.room(SCREEN).settle(); + let last = TALL[TALL.len() - 1]; + let icon = fixture.by_label(last).expect("the last group's icon").rect; + for height in [icon.bottom() + 8.0, 200.0] { + // The bounds end just below the last icon, or are shorter than the body. + let bounds = Rect::from_min_size(Pos2::ZERO, Vec2::new(SCREEN.x, height)); + within.set(bounds); + open.set(None); + fixture.settle(); + open.set(Some(TALL.len() as u8 - 1)); + fixture.settle(); + let rect = shown.get().expect("the last group's flyout is open"); + let wanted = TALL_BODY.min(bounds.height()); + assert!(bounds.bottom() - icon.top() < TALL_BODY, "the bounds leave less room below the icon than the body takes: {icon:?} in {bounds:?}"); + assert!(bounds.contains_rect(rect), "{height}: the flyout {rect:?} stays inside {bounds:?}"); + assert!(rect.height() >= wanted - 1.0, "{height}: the flyout {rect:?} takes the body's height {wanted}"); + assert!(rect.top() < icon.top(), "{height}: the flyout {rect:?} moves up from its icon {icon:?}"); + } +} + /// Each icon group's grip strip has its own room at the group's top: across the group, below the bar or the group /// before it and above the group's first icon, overlapping no icon. A drag that starts on a grip moves its whole /// group, as a drag on an icon moves its panel. From 93c2c08e50debb111c5a181a1b4b78d4f0630769 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 11:18:41 +0100 Subject: [PATCH 04/15] Dock dividers: a pointer drag leaves key focus where it was, so the arrow keys after it do not resize the dock --- crates/ui-panels/src/docking/divider.rs | 8 +++-- crates/ui-patterns/tests/it/docking/split.rs | 34 +++++++++++++++++++- docs/ui-docking.md | 2 +- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/crates/ui-panels/src/docking/divider.rs b/crates/ui-panels/src/docking/divider.rs index 11aab955d..2d7e03306 100644 --- a/crates/ui-panels/src/docking/divider.rs +++ b/crates/ui-panels/src/docking/divider.rs @@ -93,12 +93,14 @@ fn along_y(mv: NavMove) -> NavMove { } /// Declares the part `key.at(index)` for `divider`: an edge part above the panes that takes drags and is its own Tab -/// stop. `rect` is the container's rect, which the bar is mirrored across for right-to-left. The part is returned for -/// what a caller adds (a tooltip that names the edge). +/// stop. A press on it leaves key focus where it is (`Sense::KEEP_FOCUS`), so a pointer drag does not make the divider +/// the key target: the arrow keys after it still reach whatever held them, and only a divider reached by Tab takes +/// them to resize. `rect` is the container's rect, which the bar is mirrored across for right-to-left. The part is +/// returned for what a caller adds (a tooltip that names the edge). pub fn declare<'a, C: Component>(cx: &'a mut PartsCx<'_, C>, rect: Rect, key: PartKey, index: u64, divider: &Divider) -> PartBuilder<'a> { let bar = Flow::new(rect, cx.flow.is_rtl()).to_physical(divider.bar); cx.part(key.at(index), bar) - .sense(Sense::DRAG | Sense::TAKE_FOCUS) + .sense(Sense::DRAG | Sense::KEEP_FOCUS) .priority(HitPriority::new(HitLevel::Edge, 0)) .cursor(divider.cursor()) .focusable() diff --git a/crates/ui-patterns/tests/it/docking/split.rs b/crates/ui-patterns/tests/it/docking/split.rs index 2d89727a4..0e2529398 100644 --- a/crates/ui-patterns/tests/it/docking/split.rs +++ b/crates/ui-patterns/tests/it/docking/split.rs @@ -9,7 +9,7 @@ use craft_ui::docking::{DockColumn, HidePanels, PanelKey, PanelSpec}; use craft_ui::testing::memory::global; use craft_ui::testing::pointer; use craft_ui::testing::{Fixture, trial}; -use egui::{Pos2, Rect}; +use egui::{Key, Modifiers, Pos2, Rect, Vec2}; use std::cell::RefCell; use std::collections::BTreeSet; use std::rc::Rc; @@ -80,3 +80,35 @@ fn a_resize_under_a_pruned_view_keeps_the_hidden_panels() { "the resize reached the layout" ); } + +/// Tabs until the divider holds key focus. +fn tab_to_divider(fixture: &mut Fixture) { + for _ in 0..12 { + if craft_ui::testing::access::focused_key(fixture.tree()) == divider(fixture).node { + return; + } + fixture.key(Key::Tab, Modifiers::NONE).idle(2); + } + panic!("Tab never reached the divider"); +} + +/// A pointer drag of a divider leaves key focus where it was, so the next arrow key does not resize the dock; a +/// divider reached by Tab still resizes with the arrows. +#[trial] +fn a_dragged_divider_does_not_keep_the_arrow_keys_but_a_tabbed_one_takes_them() { + let (mut fixture, rects) = column(); + fixture.settle(); + let grip = divider(&fixture); + fixture.drag(&grip, Vec2::new(0.0, 20.0)).idle(2); + let dragged = rects.borrow()[0].bottom(); + assert_ne!(craft_ui::testing::access::focused_key(fixture.tree()), divider(&fixture).node, "the drag did not focus the divider"); + fixture.key(Key::ArrowDown, Modifiers::NONE).idle(2); + assert!((rects.borrow()[0].bottom() - dragged).abs() < 0.5, "the arrows after a pointer drag left the dock as it was"); + + let (mut fixture, rects) = column(); + fixture.settle(); + tab_to_divider(&mut fixture); + let tabbed = rects.borrow()[0].bottom(); + fixture.key(Key::ArrowDown, Modifiers::NONE).idle(2); + assert!((rects.borrow()[0].bottom() - tabbed).abs() > 0.5, "an arrow key moves the divider Tab reached"); +} diff --git a/docs/ui-docking.md b/docs/ui-docking.md index e1716ceef..852ad5401 100644 --- a/docs/ui-docking.md +++ b/docs/ui-docking.md @@ -118,7 +118,7 @@ The theme's docking sizes (`DockSizes`) set the drop bands and zones. `DockWords - A drag ends without a change when another arrangement replaces the workspace it started on: it records the workspace's generation, which `Workspace::replace` and the `WorkspaceSet` switch and reset change. The dock's own edits keep the generation, so they keep the drag. Every write moves the workspace's revision (`Workspace::revision`), which keys what the area derives. - A floating window's id comes from a counter its layout owns (`Layout::fresh_window_id`). It starts above every id the layout is built or loaded with and only grows while the layout lives; `Workspace::replace` gives the incoming windows ids the replaced layout never gave out, and a dock area keeps the windows its actions add above every id it has shown, so a workspace an undo brings back draws no id twice (`Workspace::raise_window_floor`). An OS window never passes to another window. - A dock column's last open group fills the column: it takes the height the other groups leave and asks for its `DockHeights::fill`. The other groups keep the height the user gave them, or take their `DockHeights::default`, which shrinks towards `compact` before the filling group gets less than its fill. Groups that ask for no heights share the free height with the filling group. -- Split handles are Tab stops, and the arrow keys move them. A divider drag is one gesture in `DockAreaOutput::edit`. +- Split handles are Tab stops, and the arrow keys move them. A pointer press or drag on a handle leaves key focus where it was, so the arrows after a drag still reach the app; only a handle reached by Tab takes them. A divider drag is one gesture in `DockAreaOutput::edit`. - A panel command (`DockCommands`) acts on the shown panel of the group that takes it. A menu row, a key and the command palette run the same code: `actions` turns the command into `Action`s. ## Commands and workspaces From afacbba6f38b183fc9755d4d375998fb4e6489c4 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 09:18:38 +0100 Subject: [PATCH 05/15] Rails: a tool's own icon replaces its command's on the rail button, flyout row and drawer row RailTool::icon takes an IconSpec, so an app whose tool artwork is a value glyph (painted, not an SVG set icon) shows it on the rail as IconButton already allows. Tools without one keep their command's icon. --- crates/ui-panels/src/rails/drawer.rs | 4 +- crates/ui-panels/src/rails/flyout.rs | 13 ++++++- crates/ui-panels/src/rails/tool/data.rs | 19 ++++++++-- crates/ui-panels/src/rails/tool/trials.rs | 45 +++++++++++++++++++++++ 4 files changed, 75 insertions(+), 6 deletions(-) diff --git a/crates/ui-panels/src/rails/drawer.rs b/crates/ui-panels/src/rails/drawer.rs index 794b54825..ac1ec35e8 100644 --- a/crates/ui-panels/src/rails/drawer.rs +++ b/crates/ui-panels/src/rails/drawer.rs @@ -280,7 +280,9 @@ impl ToolbarDrawer<'_, T> { DrawerKey::Tool { group, tool } => { let command = &resolved[group][tool]; let mut row = ListRow::new(command.label.to_string()); - if let Some(icon) = &command.icon { + if let Some(icon) = &groups[group].tools[tool].icon { + row = row.icon(icon.clone()); + } else if let Some(icon) = &command.icon { row = row.icon(IconSpec::svg(IconId::from(icon.clone()))); } if on_toolbar(toolbar, &groups[group].tools[tool].id) { diff --git a/crates/ui-panels/src/rails/flyout.rs b/crates/ui-panels/src/rails/flyout.rs index fdcdafaf0..0fdd8bdce 100644 --- a/crates/ui-panels/src/rails/flyout.rs +++ b/crates/ui-panels/src/rails/flyout.rs @@ -8,6 +8,7 @@ use crate::contract::{ PopupKind, Props as _, Remember as _, Role, Show as _, ShowContainer as _, Trigger, }; use crate::menu::{self, Menu, MenuItem}; +use crate::primitives::IconSpec; use crate::runtime::commands::{CommandRef, FireSource, ResolvedCommand}; use crate::runtime::env::Label; use crate::style::{ComponentStyle, GlyphRole, StyleCx}; @@ -162,7 +163,11 @@ impl<'a, T: Value + 'static> FlyoutButton<'a, T> { /// enabled state, marked dot). /// The button itself runs the command, so the face only wears it, and the button's selected state with it. fn face(&self, laid: &Laid, selected: bool, glyphs: GlyphRole) -> IconButton<'static> { - let icon = self.lead(laid).and_then(|resolved| resolved.icon.clone()).map_or_else(|| IconId::new("more"), IconId::from); + // The shown tool's own icon, when it has one and the face stands for it, else its command's. + let own = if self.click.is_none() { self.tools.get(laid.shown).and_then(|tool| tool.icon.clone()) } else { None }; + let icon = own.unwrap_or_else(|| { + IconSpec::svg(self.lead(laid).and_then(|resolved| resolved.icon.clone()).map_or_else(|| IconId::new("more"), IconId::from)) + }); let command = self.click.clone().or_else(|| self.tools.get(laid.shown).map(|tool| tool.command.clone())); let face = match command { Some(command) => IconButton::command(icon, command), @@ -330,7 +335,11 @@ impl Component for FlyoutButton<'_, T> { .show(ui, |ui, _| { let mut ran = None; for (at, tool) in tools.iter().enumerate() { - if MenuItem::command(tool.command.clone()).radio_mark(tool.id == *shown).show(ui).ran { + let mut row = MenuItem::command(tool.command.clone()).radio_mark(tool.id == *shown); + if let Some(icon) = &tool.icon { + row = row.icon(icon.clone()); + } + if row.show(ui).ran { ran = Some(at); } } diff --git a/crates/ui-panels/src/rails/tool/data.rs b/crates/ui-panels/src/rails/tool/data.rs index 4b4d1ee41..5cbb2f6de 100644 --- a/crates/ui-panels/src/rails/tool/data.rs +++ b/crates/ui-panels/src/rails/tool/data.rs @@ -1,12 +1,13 @@ //! The data of a tool rail: tools, slots and the tool each slot showed last. +use crate::primitives::IconSpec; use crate::runtime::commands::CommandRef; /// Names a slot of the rail. The host numbers its slots; [`LastUsed`] remembers a tool under it. pub type SlotId = u32; /// One tool of a slot. A tool is a command: the command gives the label, the icon, the chord and the enabled state, -/// and picking the tool runs it. +/// and picking the tool runs it. An [`icon`](RailTool::icon) of the tool's own replaces the command's. #[derive(Clone, Debug, PartialEq, crate::contract::MemoProps, crate::contract::PlainData)] #[non_exhaustive] pub struct RailTool { @@ -14,12 +15,24 @@ pub struct RailTool { pub id: T, /// The command the tool runs. pub command: CommandRef, + /// The icon the tool shows in place of its command's: the app's own artwork, a value glyph, where the icon sets + /// have none. + #[plain_data(assume = "an icon is a value: an SVG name, a colour or a 'static glyph compared by address, never written through")] + pub icon: Option>, } impl RailTool { - /// A tool reported as `id` that runs `command`. + /// A tool reported as `id` that runs `command`, showing its command's icon. pub fn new(id: T, command: impl Into) -> Self { - RailTool { id, command: command.into() } + RailTool { id, command: command.into(), icon: None } + } + + /// Shows `icon` for the tool, on its rail button, its flyout row and its drawer row, in place of its command's + /// icon: an app's own tool artwork (`IconSpec::glyph`). + #[must_use] + pub fn icon(mut self, icon: impl Into>) -> Self { + self.icon = Some(icon.into()); + self } } diff --git a/crates/ui-panels/src/rails/tool/trials.rs b/crates/ui-panels/src/rails/tool/trials.rs index f9b9c2404..d9d051b60 100644 --- a/crates/ui-panels/src/rails/tool/trials.rs +++ b/crates/ui-panels/src/rails/tool/trials.rs @@ -309,3 +309,48 @@ fn idle_key_bytes(count: u8) -> usize { fn a_tool_rails_idle_key_bytes_do_not_grow_with_its_slots() { assert_eq!(idle_key_bytes(10), idle_key_bytes(100), "the key follows revisions, not the slots, the hidden or the remembered tools"); } + +/// A tool's own icon replaces its command's: the app's glyph paints the rail button that shows the tool and the tool's +/// row in the flyout, and a tool without one keeps its command's icon. +#[trial] +fn a_tools_own_icon_paints_its_button_and_its_flyout_row() { + use crate::primitives::{Glyph, IconSpec}; + use crate::style::UiTokens; + use std::sync::Mutex; + + /// Where the glyph painted in the frame. + static PAINTED: Mutex> = Mutex::new(Vec::new()); + + #[derive(crate::contract::MemoProps)] + struct Artwork; + impl Glyph for Artwork { + fn paint(&self, _: &egui::Painter, _: &UiTokens, rect: Rect, _: egui::Color32, _: bool) { + PAINTED.lock().unwrap_or_else(std::sync::PoisonError::into_inner).push(rect); + } + } + static ARTWORK: Artwork = Artwork; + let painted = || std::mem::take(&mut *PAINTED.lock().unwrap_or_else(std::sync::PoisonError::into_inner)); + + let mut group = tools(&[1, 2]); + group[0] = group[0].clone().icon(IconSpec::glyph(&ARTWORK)); + let (slots, last) = (Tracked::new(vec![ToolSlot::new(0, group)]), Tracked::new(LastUsed::default())); + let mut fixture = Fixture::new(move |ui| { + ToolRail::new("Tools", &slots, &1, &last).show_rail(ui, |_, _| {}); + }); + painted(); + fixture.room(Vec2::new(200.0, 400.0)).settle(); + let button = rect(&fixture, "Brush"); + let face = painted(); + assert!(!face.is_empty() && face.iter().all(|at| button.contains_rect(*at)), "the glyph paints the Brush button: {face:?} in {button:?}"); + + // A frame's paints, which a replayed grid may not repeat: everything painted while the flyout opens and settles. + fixture.frame(vec![secondary(button.center(), true), secondary(button.center(), false)]); + fixture.settle(); + let pencil = rect(&fixture, "Pencil"); + let shown = painted(); + assert!( + shown.iter().any(|at| !button.intersects(*at) && (at.center().y - pencil.center().y).abs() > 1.0), + "the open flyout's Brush row paints the glyph too: {shown:?}, button {button:?}, Pencil row {pencil:?}" + ); + assert!(shown.iter().all(|at| !pencil.contains_rect(*at)), "the Pencil row keeps its command's icon: {shown:?} in {pencil:?}"); +} From f95acd746948c9f46617909c5d6a1783a901e5cd Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 15:05:56 +0100 Subject: [PATCH 06/15] Docking: wrap a long doc line --- crates/ui-panels/src/docking/event.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/ui-panels/src/docking/event.rs b/crates/ui-panels/src/docking/event.rs index 59a841227..d481be9e1 100644 --- a/crates/ui-panels/src/docking/event.rs +++ b/crates/ui-panels/src/docking/event.rs @@ -19,7 +19,8 @@ pub enum DockEvent

{ /// Auto-Collapse Iconic Panels was chosen in a column menu. The host flips its preference and passes it back. ToggleAutoCollapse, /// The area opened, switched or closed its flyout: an icon click, Escape, a press outside (unless - /// `DockConfig::flyout_outside_closes` is off), or a press outside or the focus leaving it under Auto-Collapse. A host that binds the flyout takes it as the request when its binding is given. + /// `DockConfig::flyout_outside_closes` is off), or a press outside or the focus leaving it under Auto-Collapse. A host + /// that binds the flyout takes it as the request when its binding is given. FlyoutChanged { /// The panel now in the flyout; `None` when it closed. panel: Option

, From 08d9dad558a0762808718c03444a85bd17ef4ebc Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 20:51:36 +0100 Subject: [PATCH 07/15] Trials: assert a relation, not a literal size; the tool-icon trial reads the frame's shapes instead of a static --- crates/ui-panels/src/docking/iconic/trials.rs | 2 +- crates/ui-panels/src/rails/tool/trials.rs | 35 +++++++++++-------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index 573ad0463..7375a802c 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -397,7 +397,7 @@ fn a_flyout_taller_than_the_room_below_its_icons_moves_up_inside_the_bounds() { let wanted = TALL_BODY.min(bounds.height()); assert!(bounds.bottom() - icon.top() < TALL_BODY, "the bounds leave less room below the icon than the body takes: {icon:?} in {bounds:?}"); assert!(bounds.contains_rect(rect), "{height}: the flyout {rect:?} stays inside {bounds:?}"); - assert!(rect.height() >= wanted - 1.0, "{height}: the flyout {rect:?} takes the body's height {wanted}"); + assert!(rect.height() > wanted || near(rect.height(), wanted), "{height}: the flyout {rect:?} takes the body's height {wanted}"); assert!(rect.top() < icon.top(), "{height}: the flyout {rect:?} moves up from its icon {icon:?}"); } } diff --git a/crates/ui-panels/src/rails/tool/trials.rs b/crates/ui-panels/src/rails/tool/trials.rs index d9d051b60..a6bd425f3 100644 --- a/crates/ui-panels/src/rails/tool/trials.rs +++ b/crates/ui-panels/src/rails/tool/trials.rs @@ -316,40 +316,47 @@ fn a_tool_rails_idle_key_bytes_do_not_grow_with_its_slots() { fn a_tools_own_icon_paints_its_button_and_its_flyout_row() { use crate::primitives::{Glyph, IconSpec}; use crate::style::UiTokens; - use std::sync::Mutex; - - /// Where the glyph painted in the frame. - static PAINTED: Mutex> = Mutex::new(Vec::new()); + /// An app's tool artwork: one ellipse across its rect, a shape nothing else on the rail paints, so the frame's + /// shapes say where the glyph painted. #[derive(crate::contract::MemoProps)] struct Artwork; impl Glyph for Artwork { - fn paint(&self, _: &egui::Painter, _: &UiTokens, rect: Rect, _: egui::Color32, _: bool) { - PAINTED.lock().unwrap_or_else(std::sync::PoisonError::into_inner).push(rect); + fn paint(&self, painter: &egui::Painter, _: &UiTokens, rect: Rect, color: egui::Color32, _: bool) { + painter.add(egui::Shape::ellipse_filled(rect.center(), rect.size() / 2.0, color)); } } - static ARTWORK: Artwork = Artwork; - let painted = || std::mem::take(&mut *PAINTED.lock().unwrap_or_else(std::sync::PoisonError::into_inner)); + /// Where the glyph painted in the fixture's next frame. A frame that replays a memoized view repeats its shapes, so + /// the shapes of one frame show every place the glyph is on screen. + let painted = |fixture: &mut Fixture| -> Vec { + fixture + .frame_shapes() + .iter() + .filter_map(|shape| match shape { + egui::Shape::Ellipse(ellipse) => Some(Rect::from_center_size(ellipse.center, ellipse.radius * 2.0)), + _ => None, + }) + .collect() + }; let mut group = tools(&[1, 2]); - group[0] = group[0].clone().icon(IconSpec::glyph(&ARTWORK)); + group[0] = group[0].clone().icon(IconSpec::glyph(&Artwork)); let (slots, last) = (Tracked::new(vec![ToolSlot::new(0, group)]), Tracked::new(LastUsed::default())); let mut fixture = Fixture::new(move |ui| { ToolRail::new("Tools", &slots, &1, &last).show_rail(ui, |_, _| {}); }); - painted(); fixture.room(Vec2::new(200.0, 400.0)).settle(); let button = rect(&fixture, "Brush"); - let face = painted(); + let face = painted(&mut fixture); assert!(!face.is_empty() && face.iter().all(|at| button.contains_rect(*at)), "the glyph paints the Brush button: {face:?} in {button:?}"); - // A frame's paints, which a replayed grid may not repeat: everything painted while the flyout opens and settles. + // With the flyout open the glyph paints the Brush row too, and the Pencil row keeps its command's icon. fixture.frame(vec![secondary(button.center(), true), secondary(button.center(), false)]); fixture.settle(); let pencil = rect(&fixture, "Pencil"); - let shown = painted(); + let shown = painted(&mut fixture); assert!( - shown.iter().any(|at| !button.intersects(*at) && (at.center().y - pencil.center().y).abs() > 1.0), + shown.iter().any(|at| !button.intersects(*at) && !pencil.contains(at.center())), "the open flyout's Brush row paints the glyph too: {shown:?}, button {button:?}, Pencil row {pencil:?}" ); assert!(shown.iter().all(|at| !pencil.contains_rect(*at)), "the Pencil row keeps its command's icon: {shown:?} in {pencil:?}"); From 0bd8fa66fedced86361ce29b8895939d49c6115a Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 22:46:54 +0100 Subject: [PATCH 08/15] Rails trial: a plain comment on the closure, which a doc comment cannot document --- crates/ui-panels/src/rails/tool/trials.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ui-panels/src/rails/tool/trials.rs b/crates/ui-panels/src/rails/tool/trials.rs index c617f7678..e11eb8a40 100644 --- a/crates/ui-panels/src/rails/tool/trials.rs +++ b/crates/ui-panels/src/rails/tool/trials.rs @@ -370,8 +370,8 @@ fn a_tools_own_icon_paints_its_button_and_its_flyout_row() { use crate::primitives::{Glyph, IconSpec}; use crate::style::UiTokens; - /// An app's tool artwork: one ellipse across its rect, a shape nothing else on the rail paints, so the frame's - /// shapes say where the glyph painted. + // An app's tool artwork: one ellipse across its rect, a shape nothing else on the rail paints, so the frame's + // shapes say where the glyph painted. #[derive(crate::contract::MemoProps)] struct Artwork; impl Glyph for Artwork { @@ -379,8 +379,8 @@ fn a_tools_own_icon_paints_its_button_and_its_flyout_row() { painter.add(egui::Shape::ellipse_filled(rect.center(), rect.size() / 2.0, color)); } } - /// Where the glyph painted in the fixture's next frame. A frame that replays a memoized view repeats its shapes, so - /// the shapes of one frame show every place the glyph is on screen. + // Where the glyph painted in the fixture's next frame. A frame that replays a memoized view repeats its shapes, so + // the shapes of one frame show every place the glyph is on screen. let painted = |fixture: &mut Fixture| -> Vec { fixture .frame_shapes() From db3553a14128fb8fa4e8e5378b084a61fea1e4db Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 24 Nov 2026 02:03:12 +0100 Subject: [PATCH 09/15] Docking: drop DockConfig::flyout_outside_closes, which next's flyout outside rule covers Next 34d7846cd closes an iconic column's flyout on a press outside only with Auto-Collapse Iconic Panels on, the rule the option turned on. Its trial a_press_outside_closes_the_flyout_only_with_auto_collapse covers both cases, so the option, its plumbing and its trial go. --- crates/ui-panels/src/docking/config.rs | 12 ------ crates/ui-panels/src/docking/event.rs | 5 +-- crates/ui-panels/src/docking/flyout.rs | 32 +++------------ crates/ui-panels/src/docking/iconic.rs | 11 ++---- crates/ui-panels/src/docking/iconic/trials.rs | 39 ------------------- crates/ui-patterns/src/patterns/dock/area.rs | 1 - 6 files changed, 11 insertions(+), 89 deletions(-) diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index 11a6359cc..9aeecde22 100644 --- a/crates/ui-panels/src/docking/config.rs +++ b/crates/ui-panels/src/docking/config.rs @@ -103,10 +103,6 @@ pub struct DockConfig { /// none for its panel. Off: only a group whose shown panel has host rows (`DockPanels::panel_rows`) shows the /// button, and the dock's rows open from a context request on a tab. pub menu_button: bool, - /// A press outside an iconic column's open flyout closes it without Auto-Collapse Iconic Panels too. Off (the - /// default), the flyout stays open while the person works elsewhere, until Escape, its icon or, with Auto-Collapse, - /// a press outside or the focus leaving it closes it. - pub flyout_outside_closes: bool, } impl Default for DockConfig { @@ -130,7 +126,6 @@ impl Default for DockConfig { group_order_items: false, iconic_mode: IconicMode::Flyouts, menu_button: false, - flyout_outside_closes: false, } } } @@ -150,13 +145,6 @@ impl DockConfig { self } - /// Whether a press outside an iconic column's open flyout closes it without Auto-Collapse Iconic Panels. - #[must_use] - pub fn flyout_outside_closes(mut self, on: bool) -> Self { - self.flyout_outside_closes = on; - self - } - /// The Minimize and Move Group Up and Down items of docked groups' menus on or off. #[must_use] pub fn group_order_items(mut self, on: bool) -> Self { diff --git a/crates/ui-panels/src/docking/event.rs b/crates/ui-panels/src/docking/event.rs index 96f7a5080..31deb677f 100644 --- a/crates/ui-panels/src/docking/event.rs +++ b/crates/ui-panels/src/docking/event.rs @@ -18,9 +18,8 @@ pub enum DockEvent

{ }, /// Auto-Collapse Iconic Panels was chosen in a column menu. The host flips its preference and passes it back. ToggleAutoCollapse, - /// The area opened, switched or closed its flyout: an icon click, Escape, a press outside (with - /// `DockConfig::flyout_outside_closes` on), or a press outside or the focus leaving it under Auto-Collapse. A host - /// that binds the flyout takes it as the request when its binding is given. + /// The area opened, switched or closed its flyout: an icon click, Escape, or a press outside or the focus leaving + /// it under Auto-Collapse. A host that binds the flyout takes it as the request when its binding is given. FlyoutChanged { /// The panel now in the flyout; `None` when it closed. panel: Option

, diff --git a/crates/ui-panels/src/docking/flyout.rs b/crates/ui-panels/src/docking/flyout.rs index ff6263a9a..0a280866a 100644 --- a/crates/ui-panels/src/docking/flyout.rs +++ b/crates/ui-panels/src/docking/flyout.rs @@ -49,11 +49,10 @@ impl Outcome for FlyoutOutput { } /// A popup beside an iconic column, on the side of the canvas, whose top left the caller places. Escape closes it; with -/// Auto-Collapse Iconic Panels, or with [`outside_closes`](Flyout::outside_closes) on, a press outside it closes it, and -/// with Auto-Collapse the focus leaving it too. Its body is measured at the flyout's width first: the flyout is as tall -/// as the body measures, at most the height of `within`, and at least its `size`'s height, and the body then shows in -/// the rect that takes. A flyout taller than the room below its top moves up to stay inside `within` (the layer keeps -/// inside its bounds) and scrolls only when it is taller than `within`. +/// Auto-Collapse Iconic Panels a press outside it and the focus leaving it close it too. Its body is measured at the +/// flyout's width first: the flyout is as tall as the body measures, at most the height of `within`, and at least its +/// `size`'s height, and the body then shows in the rect that takes. A flyout taller than the room below its top moves +/// up to stay inside `within` (the layer keeps inside its bounds) and scrolls only when it is taller than `within`. /// /// The user resizes it by its top and bottom edges, the edge away from the column and the two corners there; the /// column side stays. The flyout keeps no rect of its own: each step comes back in [`FlyoutShown::placed`] and the @@ -74,11 +73,6 @@ pub struct Flyout { /// The least size a resize leaves the flyout. #[prop(quantity = "least room a resize leaves, from the dock's measured sizes, in points")] least: Vec2, - /// Whether a press outside closes the flyout without Auto-Collapse Iconic Panels. Off (the default), only Escape, the - /// column's icons and, with Auto-Collapse, a press outside and the focus leaving it close it: work on the canvas - /// leaves it open. - #[prop] - outside_closes: bool, placed: Option, } @@ -87,17 +81,7 @@ impl Flyout { /// `Side::End`), closing on a press outside it and when the focus leaves it if `auto_collapse`. pub fn new(opens: Side, size: Vec2, auto_collapse: bool) -> Self { let props = ContainerProps::new().surface(SurfaceKind::Popup).pad(Pad::None).sizing(Sizing::Content); - Flyout { - common: Common::new(), - props, - opens, - size, - auto_collapse, - within: Rect::EVERYTHING, - least: Vec2::ZERO, - outside_closes: false, - placed: None, - } + Flyout { common: Common::new(), props, opens, size, auto_collapse, within: Rect::EVERYTHING, least: Vec2::ZERO, placed: None } } /// The layer the flyout shows in, its top left at `top_left`: placed by the caller, resizable on every edge but @@ -113,11 +97,7 @@ impl Flyout { .placed_at(top_left) .size_limits(SizeLimits::at_least(least)) .resize_edges(free.union(ResizeEdges::TOP).union(ResizeEdges::BOTTOM)) - .dismiss( - Dismiss::new() - .outside(if self.outside_closes || self.auto_collapse { Outside::Close } else { Outside::Keep }) - .focus_left(self.auto_collapse), - ) + .dismiss(Dismiss::new().outside(if self.auto_collapse { Outside::Close } else { Outside::Keep }).focus_left(self.auto_collapse)) .body_scroll(false); if bounded { overlay.bounds(self.within) } else { overlay } } diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index bd4d2e1ac..7f5edb52d 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -171,8 +171,7 @@ pub struct IconicColumnStyle { /// opens the flyout of its panel beside the column, switches it to that panel or closes it; one flyout is open at a /// time. A drag of an icon starts a move of its panel, a drag of the grip on top of a group a move of the group, a /// drag of the bar beside its button a move of the column; each starts through the drag session. Escape closes the -/// flyout; with `auto_collapse` a press outside it and the focus leaving it do too, and with `outside_closes` a press -/// outside it does. +/// flyout; with `auto_collapse` a press outside it and the focus leaving it do too. /// /// The open flyout is the bound `Option

` of [`new`](IconicColumn::new), owned by the host like the layout: a click /// on an icon, Escape and auto-collapse write it, and the host opens a panel (the Window menu) by writing it. The @@ -218,9 +217,6 @@ pub struct IconicColumn<'a, P: Value + Hash + 'static> { /// What the icons open: flyouts, or the column itself as a rail. #[prop] mode: IconicMode, - /// Whether a press outside the open flyout closes it ([`Flyout::outside_closes`]) without `auto_collapse`; off by default. - #[prop] - outside_closes: bool, /// The rect the dock may grow within, which bounds how wide its inner edge can make the column, and the rect its /// flyouts open in. Unset, the flyouts take the room layers opened there have (`overlay::layer_room`): around a /// palette window, the work area. @@ -286,7 +282,6 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { bar: ColumnBar::Own, auto_collapse: false, mode: IconicMode::Flyouts, - outside_closes: false, within: Rect::NOTHING, open, view: None, @@ -685,7 +680,7 @@ impl Component for IconicColumn<'_, P> { } let popup = cx.popup("flyout"); let sizes = cx.style.sizes.column; - let (opens, auto_collapse, outside_closes, column) = (self.opens, self.auto_collapse, self.outside_closes, cx.rect); + let (opens, auto_collapse, column) = (self.opens, self.auto_collapse, cx.rect); // The screen side the flyouts open on, mirrored in a right-to-left layout. let right = (opens == Side::End) != cx.flow.is_rtl(); let within = if self.within.is_positive() { self.within } else { crate::contract::overlay::layer_room(&cx.core.ctx) }; @@ -703,7 +698,7 @@ impl Component for IconicColumn<'_, P> { let mut resized = None; for (at, plan) in plans.into_iter().enumerate() { let Some(FlyoutPlan { group, top_left, size, fixed, icons_top }) = plan else { continue }; - let shown = Flyout::new(opens, size, auto_collapse).within(bounds).least(least).outside_closes(outside_closes).show_popup( + let shown = Flyout::new(opens, size, auto_collapse).within(bounds).least(least).show_popup( ui, popup.at(at), Anchor::Point(top_left), diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index 71eea53f7..3d7a2e1a3 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -638,42 +638,3 @@ fn a_themes_grip_shape_reaches_the_grips() { assert!(marks.windows(2).all(|w| equals_token(w[1].min.x - w[0].max.x, shape.gap)), "three points apart: {marks:?}"); assert_ne!(ink, egui::Color32::TRANSPARENT); } - -/// An iconic column at the start of a wide room, its flyout's outside rule `outside_closes` and Auto-Collapse -/// `auto_collapse`, and the panel whose flyout is open. -fn outside_column(outside_closes: bool, auto_collapse: bool) -> (Fixture, Rc>>) { - let open = Rc::new(Cell::new(None)); - let seen = Rc::clone(&open); - let mut fixture = Fixture::new(move |ui| { - let column = Column::new(vec![Group::new(vec![0, 1], 0)]); - let mut now = seen.get(); - let (rail, _) = ui.max_rect().split_left_right_at_x(ui.max_rect().left() + RAIL); - IconicColumn::new("Panels", global("iconic column", "outside"), &column, Bind::bound(&mut now), &spec) - .outside_closes(outside_closes) - .auto_collapse(auto_collapse) - .within(screen()) - .show_flyouts_at(ui, rail, |_, at, ui, _| { - let GroupAt::Show(rect) = at else { return None }; - Panel::new("Flyout").show_at(ui, rect, |_, _| ()); - None - }); - seen.set(now); - }); - fixture.room(SCREEN).settle(); - (fixture, open) -} - -/// A press outside the open flyout closes it with `outside_closes` on; off (the default) it stays open, unless -/// Auto-Collapse Iconic Panels is on, which closes it there. -#[trial] -fn a_press_outside_closes_the_flyout_only_where_outside_closes_or_auto_collapse_is_on() { - for (outside_closes, auto_collapse, stays) in [(true, false, false), (false, false, true), (false, true, false)] { - let (mut fixture, open) = outside_column(outside_closes, auto_collapse); - let icon = fixture.by_label("Swatches").expect("the Swatches icon"); - fixture.click(&icon).idle(3); - assert_eq!(open.get(), Some(1), "a click on the icon opens its flyout"); - fixture.click_at(Pos2::new(SCREEN.x - 20.0, SCREEN.y - 20.0)).idle(3); - let expected = if stays { Some(1) } else { None }; - assert_eq!(open.get(), expected, "outside_closes {outside_closes}, auto_collapse {auto_collapse}: a press outside"); - } -} diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 9b13eebc4..d5073013a 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -1339,7 +1339,6 @@ impl Pass<'_, P> { .bar(bar) .within(within) .auto_collapse(scene.auto_collapse) - .outside_closes(scene.config.flyout_outside_closes) .mode(mode) .show_flyouts_at(ui, rect, |group, at, ui, body| pass.borrow_mut().group_of(ui, body, group, at, in_window)) }; From 13687e15af846bf36cdbc28f12bd55c864b75cab Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 24 Nov 2026 14:52:07 +0100 Subject: [PATCH 10/15] Docking: make DockConfig::menu_button a named option, GroupMenuButton::{HostRows, EveryGroup} The panel menu button choice was a per-app boolean; the variant rule asks for named options. GroupMenuButton defaults to HostRows, today's behaviour (the button only on groups whose shown panel has host rows). The panel menu trial covers both options and the default, and the DockConfig table in docs/ui-docking.md lists the field. --- crates/ui-panels/src/docking/config.rs | 26 +++++++++++++------ crates/ui-panels/src/docking/mod.rs | 2 +- crates/ui-patterns/src/patterns/dock/area.rs | 6 ++--- .../tests/it/docking/panel_menu.rs | 15 ++++++----- docs/ui-docking.md | 1 + 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index 9aeecde22..3fd905373 100644 --- a/crates/ui-panels/src/docking/config.rs +++ b/crates/ui-panels/src/docking/config.rs @@ -99,10 +99,20 @@ pub struct DockConfig { /// What the icons of a docked column collapsed to icons open: flyouts, or with [`IconicMode::Rail`] the column /// itself, whose icons then stay beside it while it is expanded. Floating windows' icons open flyouts. pub iconic_mode: IconicMode, - /// Every group shows the panel menu button at the end of its tab strip, listing the dock's rows when the host has - /// none for its panel. Off: only a group whose shown panel has host rows (`DockPanels::panel_rows`) shows the - /// button, and the dock's rows open from a context request on a tab. - pub menu_button: bool, + /// Which groups show the panel menu button at the end of their tab strip. + pub menu_button: GroupMenuButton, +} + +/// Which groups show the panel menu button at the end of their tab strip ([`DockConfig::menu_button`]). +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum GroupMenuButton { + /// Only a group whose shown panel has host rows (`DockPanels::panel_rows`) shows the button; the dock's rows open + /// from a context request on a tab. + #[default] + HostRows, + /// Every group shows the button, listing the dock's rows when the host has none for its panel. + EveryGroup, } impl Default for DockConfig { @@ -125,7 +135,7 @@ impl Default for DockConfig { native_windows: true, group_order_items: false, iconic_mode: IconicMode::Flyouts, - menu_button: false, + menu_button: GroupMenuButton::HostRows, } } } @@ -138,10 +148,10 @@ impl DockConfig { self } - /// The panel menu button on every group on or off. + /// Which groups show the panel menu button. #[must_use] - pub fn menu_button(mut self, on: bool) -> Self { - self.menu_button = on; + pub fn menu_button(mut self, shown: GroupMenuButton) -> Self { + self.menu_button = shown; self } diff --git a/crates/ui-panels/src/docking/mod.rs b/crates/ui-panels/src/docking/mod.rs index 37ceceb30..5c3c11a72 100644 --- a/crates/ui-panels/src/docking/mod.rs +++ b/crates/ui-panels/src/docking/mod.rs @@ -30,7 +30,7 @@ mod commands; pub mod cross_window; pub mod native; -pub use config::{DockConfig, DockSides}; +pub use config::{DockConfig, DockSides, GroupMenuButton}; #[doc(hidden)] pub use drop::{Arrangement, end_replaced_drags}; pub use drop::{DockDrag, DockDropTarget, DockDropped, DragUnit, float_drop, resolve_drop, start_group_drag, start_icon_drag}; diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index d5073013a..10b85270a 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -15,8 +15,8 @@ use crate::docking::{Arrangement, close_requests, cross_window, end_replaced_dra use crate::docking::{ ColumnArrow, ColumnBar, DockColumn, DockCommands, DockConfig, DockDropTarget, DockDropped, DockEvent, DockGroup, DockPanels, DockRoot, DockScene, DockSizes, DockSpot, DockTargets, DockTo, DockWords, DragUnit, FloatSpace, FloatingGroup, FlyoutResize, GroupAt, GroupDrag, GroupGrip, - HidePanels, IconicColumn, IconicMode, IconicSizes, PanelDrag, PanelKey, PanelSpec, PanelSpecs, PanelTitle, Placing, SpecSource, SplitArea, - Titles, WindowColumn, actions, dock_states, fit_widths, frame, move_actions, + GroupMenuButton, HidePanels, IconicColumn, IconicMode, IconicSizes, PanelDrag, PanelKey, PanelSpec, PanelSpecs, PanelTitle, Placing, SpecSource, + SplitArea, Titles, WindowColumn, actions, dock_states, fit_widths, frame, move_actions, }; use crate::layout_components::Stack; use crate::menu::{GroupItem, MenuWords, PanelMenu, PanelRow}; @@ -1093,7 +1093,7 @@ impl Pass<'_, P> { .zones(scene.config.zone_rule()) .movable(scene.permissions(shown).movable) .menu(move || panel_menu_rows(scene, &mut **panels.borrow_mut(), words, shown).0) - .panel_menu_shown(*hosted || scene.config.menu_button) + .panel_menu_shown(*hosted || scene.config.menu_button == GroupMenuButton::EveryGroup) .command_states(states.clone()); if look.in_window { group = group.in_window(); diff --git a/crates/ui-patterns/tests/it/docking/panel_menu.rs b/crates/ui-patterns/tests/it/docking/panel_menu.rs index 84904f40a..930700da9 100644 --- a/crates/ui-patterns/tests/it/docking/panel_menu.rs +++ b/crates/ui-patterns/tests/it/docking/panel_menu.rs @@ -5,7 +5,7 @@ use craft_behavior::Axis; use craft_behavior::PartKey; use craft_behavior::dock::{Action, Column, DockEdge, Group, Layout, Node, SplitSize, Workspace}; use craft_ui::contract::{Bind, BodyCx, PlainData, Role, ShowContainer as _, Tracked}; -use craft_ui::docking::{DockConfig, DockPanels, PanelSpec, PanelSpecs, WindowMenuRows}; +use craft_ui::docking::{DockConfig, DockPanels, GroupMenuButton, PanelSpec, PanelSpecs, WindowMenuRows}; use craft_ui::menu::{Menu, PanelRow}; use craft_ui::patterns::dock::DockArea; use craft_ui::testing::{Fixture, trial}; @@ -155,24 +155,25 @@ impl DockPanels for Bare { fn body(&mut self, _: &usize, _: &mut Ui, _: &mut BodyCx<'_>) {} } -/// With `DockConfig::menu_button`, a group whose panel has no host rows still shows the panel menu button, and its -/// menu lists the dock's rows; without it the group shows none. +/// With `GroupMenuButton::EveryGroup`, a group whose panel has no host rows still shows the panel menu button, and its +/// menu lists the dock's rows; with the default `GroupMenuButton::HostRows` the group shows none. #[trial] fn the_menu_button_config_shows_the_panel_menu_without_host_rows() { - for on in [false, true] { + assert_eq!(DockConfig::default().menu_button, GroupMenuButton::HostRows, "by default only groups with host rows show the button"); + for button in [GroupMenuButton::HostRows, GroupMenuButton::EveryGroup] { let root = Node::split(Axis::X, SplitSize::Ratio(0.5), Node::tabs(vec![0, 1], 0), Node::tabs(vec![2], 0)); let workspace = Rc::new(RefCell::new(Arc::new(Workspace::new(Layout::new(Some(root), Vec::new()))))); let (held, specs) = (Rc::clone(&workspace), Tracked::new(Specs)); let mut fixture = Fixture::new(move |ui| { let mut shown = held.borrow().clone(); - DockArea::new("Dock", Bind::bound(&mut shown), &specs, &mut Bare, DockConfig::default().menu_button(on)).show(ui); + DockArea::new("Dock", Bind::bound(&mut shown), &specs, &mut Bare, DockConfig::default().menu_button(button)).show(ui); *held.borrow_mut() = shown; }); fixture.room(Vec2::new(1200.0, 600.0)).settle(); let buttons: Vec<_> = fixture.by_role(Role::BUTTON).into_iter().filter(|button| fixture.tree().name_of(button.node) == Some("Panel Menu")).collect(); - if !on { - assert!(buttons.is_empty(), "without host rows and without the config, no group shows the button"); + if button == GroupMenuButton::HostRows { + assert!(buttons.is_empty(), "without host rows and with only host-row groups showing it, no group shows the button"); continue; } assert_eq!(buttons.len(), 2, "each group shows its panel menu button"); diff --git a/docs/ui-docking.md b/docs/ui-docking.md index d6d92ebc9..e76cdb5b3 100644 --- a/docs/ui-docking.md +++ b/docs/ui-docking.md @@ -102,6 +102,7 @@ The host handles these `DockEvent`s: | `title_bar_docks` | on | Dragging a floating window's title bar onto a target docks the whole window. | | `close_menu_items`, `close_button` | on | Built-in Close items, and the close action on floating windows. | | `tab_close_buttons` | off | Close buttons on tabs (middle click closes too), for tabs that act as documents. | +| `menu_button` | `GroupMenuButton::HostRows` | Which groups show the panel menu button: only those whose shown panel has host rows (`DockPanels::panel_rows`), or with `EveryGroup` every group, its menu listing the dock's rows when the host has none. | | `native_windows` | on | Floating windows open as OS windows where the window host opens them and reports their positions (not on Wayland) and `PanelSpec::allow_native` allows. | The theme's docking sizes (`DockSizes`) set the drop bands and zones. `DockWords` holds the words. From 46709568a4ca0c20059ea832bf64819bcb6c0696 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 24 Nov 2026 14:54:46 +0100 Subject: [PATCH 11/15] Docking: pin that a flyout on a short window moves up only by its overflow A flyout measures its body against the whole bounds height, and the layer's keep rule moves it the least distance into its bounds: a body that fits below its icons keeps the flyout's top there, and a taller one moves up by what it overflows, its bottom on the bounds' bottom, never above their top. A new short-window trial checks both cases; the tall-body trial shares its fixture and keeps its assertions. The Flyout and IconicColumn docs state the rule. --- crates/ui-panels/src/docking/flyout.rs | 10 +-- crates/ui-panels/src/docking/iconic.rs | 3 +- crates/ui-panels/src/docking/iconic/trials.rs | 71 +++++++++++++++---- 3 files changed, 66 insertions(+), 18 deletions(-) diff --git a/crates/ui-panels/src/docking/flyout.rs b/crates/ui-panels/src/docking/flyout.rs index 0a280866a..44505cbc3 100644 --- a/crates/ui-panels/src/docking/flyout.rs +++ b/crates/ui-panels/src/docking/flyout.rs @@ -51,8 +51,10 @@ impl Outcome for FlyoutOutput { /// A popup beside an iconic column, on the side of the canvas, whose top left the caller places. Escape closes it; with /// Auto-Collapse Iconic Panels a press outside it and the focus leaving it close it too. Its body is measured at the /// flyout's width first: the flyout is as tall as the body measures, at most the height of `within`, and at least its -/// `size`'s height, and the body then shows in the rect that takes. A flyout taller than the room below its top moves -/// up to stay inside `within` (the layer keeps inside its bounds) and scrolls only when it is taller than `within`. +/// `size`'s height, and the body then shows in the rect that takes. A flyout that fits below its top stays there; one +/// taller than the room below its top moves up by what it overflows and no further, its bottom on `within`'s (the +/// layer's keep rule moves it the least distance into its bounds), and only one taller than `within` starts at +/// `within`'s top and scrolls. /// /// The user resizes it by its top and bottom edges, the edge away from the column and the two corners there; the /// column side stays. The flyout keeps no rect of its own: each step comes back in [`FlyoutShown::placed`] and the @@ -121,8 +123,8 @@ impl Flyout { } }; let size = self.size; - // A body measures no taller than the bounds: a flyout that does not fit below its top moves up, so only a body - // taller than the bounds is limited to them. + // A body measures no taller than the bounds: a flyout that does not fit below its top moves up by its overflow + // alone, so only a body taller than the bounds is limited to them. let room = self.within.height().max(size.y); let overlay = self.overlay(top_left, ui.is_rtl()); self.props = self.props.mount(Mount::Layer(overlay)); diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 7f5edb52d..35926faa3 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -179,7 +179,8 @@ pub struct IconicColumnStyle { /// icon groups, the top and bottom of the stack and each icon group's cells, which join its tabs. The flyout shows /// its group through the `view` of [`show_flyouts`](IconicColumn::show_flyouts), with the opened panel active, as tall as the view measures the /// group within the room and at least the height of its panels' default heights; a group the user sized keeps that -/// size. The flyout's top is level with its group's icons, shifted by the group's `flyout_offset`, inside `within`. +/// size. The flyout's top is level with its group's icons, shifted by the group's `flyout_offset`, inside `within`; +/// a flyout taller than the room below that top moves up by what it overflows and no further. /// The user resizes it by its top and bottom edges and the edge away from the column; each step comes back in /// [`IconicColumnOutput::flyout`], which the host keeps in the group (`flyout_width`, `height`, `flyout_offset`). /// diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index 3d7a2e1a3..0158d7f1d 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -368,18 +368,21 @@ fn a_flyout_with_an_offset_in_a_short_viewport_stays_inside_and_resizes_its_widt } } -/// The names of the panels of the tall-body trial, which sets no heights. +/// The names of the panels of the tall-body trials, which set no heights. const TALL: [&str; 8] = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight"]; /// What the body of a flyout in the tall-body trial measures. const TALL_BODY: f32 = 300.0; +/// The room below the last group's icon in the short-window trial. +const ROOM_BELOW: f32 = 200.0; +/// How much shorter than that room the body of the flyout that fits measures, and how much taller the one that does not. +const OVERFLOW: f32 = 40.0; -/// A flyout whose body measures taller than the room below its group's icons moves up to stay inside the bounds, as -/// tall as the body (or as the bounds when those are shorter): it is not cut to the room below its top with the rest -/// of its body laid out below the bounds. The panels set no heights, so the group's height does not give the room. -#[trial] -fn a_flyout_taller_than_the_room_below_its_icons_moves_up_inside_the_bounds() { - let (within, open, shown) = (Rc::new(Cell::new(screen())), Rc::new(Cell::new(None)), Rc::new(Cell::new(None))); - let (bounds, now, seen) = (Rc::clone(&within), Rc::clone(&open), Rc::clone(&shown)); +/// A column of the [`TALL`] panels, each in a group of its own, on the left window edge; its flyouts stay inside the +/// bounds `within` holds and their bodies measure the height `body` holds. Returns the fixture, the panel whose flyout +/// is open (the trial sets it) and the rect the open flyout's body showed in, last pass. +fn tall_flyouts(within: &Rc>, body: &Rc>) -> (Fixture, Rc>>, Rc>>) { + let (open, shown) = (Rc::new(Cell::new(None)), Rc::new(Cell::new(None))); + let (bounds, measures, now, seen) = (Rc::clone(within), Rc::clone(body), Rc::clone(&open), Rc::clone(&shown)); let mut column = Column::new((0..TALL.len() as u8).map(|panel| Group::new(vec![panel], 0)).collect()); column.iconic = true; let mut fixture = Fixture::new(move |ui| { @@ -393,7 +396,7 @@ fn a_flyout_taller_than_the_room_below_its_icons_moves_up_inside_the_bounds() { .within(bounds.get()) .show_flyouts_at(ui, Rect::from_min_size(Pos2::ZERO, Vec2::new(RAIL, SCREEN.y)), |group, at, ui, _| { match at { - GroupAt::Measure(_) => return Some(TALL_BODY), + GroupAt::Measure(_) => return Some(measures.get()), GroupAt::Show(rect) => { if group.active_panel().is_some_and(|panel| Some(*panel) == current) { seen.set(Some(rect)); @@ -406,16 +409,31 @@ fn a_flyout_taller_than_the_room_below_its_icons_moves_up_inside_the_bounds() { now.set(opened); }); fixture.room(SCREEN).settle(); + (fixture, open, shown) +} + +/// Closes the open flyout of [`tall_flyouts`] and opens the last group's. +fn reopen_last(fixture: &mut Fixture, open: &Cell>) { + open.set(None); + fixture.settle(); + open.set(Some(TALL.len() as u8 - 1)); + fixture.settle(); +} + +/// A flyout whose body measures taller than the room below its group's icons moves up to stay inside the bounds, as +/// tall as the body (or as the bounds when those are shorter): it is not cut to the room below its top with the rest +/// of its body laid out below the bounds. The panels set no heights, so the group's height does not give the room. +#[trial] +fn a_flyout_taller_than_the_room_below_its_icons_moves_up_inside_the_bounds() { + let (within, body) = (Rc::new(Cell::new(screen())), Rc::new(Cell::new(TALL_BODY))); + let (mut fixture, open, shown) = tall_flyouts(&within, &body); let last = TALL[TALL.len() - 1]; let icon = fixture.by_label(last).expect("the last group's icon").rect; for height in [icon.bottom() + 8.0, 200.0] { // The bounds end just below the last icon, or are shorter than the body. let bounds = Rect::from_min_size(Pos2::ZERO, Vec2::new(SCREEN.x, height)); within.set(bounds); - open.set(None); - fixture.settle(); - open.set(Some(TALL.len() as u8 - 1)); - fixture.settle(); + reopen_last(&mut fixture, &open); let rect = shown.get().expect("the last group's flyout is open"); let wanted = TALL_BODY.min(bounds.height()); assert!(bounds.bottom() - icon.top() < TALL_BODY, "the bounds leave less room below the icon than the body takes: {icon:?} in {bounds:?}"); @@ -425,6 +443,33 @@ fn a_flyout_taller_than_the_room_below_its_icons_moves_up_inside_the_bounds() { } } +/// On a short window a flyout whose body fits below its group's icons keeps its top at the icons, and one whose body +/// is taller than the room below them moves up only by what it overflows, its bottom on the bounds' bottom: neither +/// takes the whole height of the bounds over the column's other icons. +#[trial] +fn a_flyout_on_a_short_window_moves_up_only_by_its_overflow() { + let (within, body) = (Rc::new(Cell::new(screen())), Rc::new(Cell::new(TALL_BODY))); + let (mut fixture, open, shown) = tall_flyouts(&within, &body); + let icon = fixture.by_label(TALL[TALL.len() - 1]).expect("the last group's icon").rect; + let bounds = Rect::from_min_size(Pos2::ZERO, Vec2::new(SCREEN.x, icon.top() + ROOM_BELOW)); + within.set(bounds); + let sizes = StyleCx::with_root(fixture.ctx(), DockSizes::style); + let least = sizes.strip + sizes.least; + assert!(icon.top() - OVERFLOW > bounds.top(), "the bounds leave room above the icon for the taller flyout to move up: {icon:?}"); + for over in [-OVERFLOW, OVERFLOW] { + let height = ROOM_BELOW + over; + assert!(height > least, "{over}: the body {height} measures taller than the flyout's least height {least}"); + body.set(height); + reopen_last(&mut fixture, &open); + let rect = shown.get().expect("the last group's flyout is open"); + // A body that fits stays at the icon's top; a taller one moves up by its overflow alone. + let top = icon.top() - over.max(0.0); + assert!(near(rect.height(), height), "{over}: the flyout {rect:?} takes its body's height {height}"); + assert!(near(rect.top(), top), "{over}: the flyout {rect:?} has its top at {top}, below the icon {icon:?} or up by its overflow"); + assert!(bounds.contains_rect(rect), "{over}: the flyout {rect:?} stays inside {bounds:?}"); + } +} + /// Each icon group's grip strip has its own room at the group's top: across the group, below the bar or the group /// before it and above the group's first icon, overlapping no icon. A drag that starts on a grip moves its whole /// group, as a drag on an icon moves its panel. From 5b155ab03f9cd853e0cd2038bd615bddab5ea374 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 24 Nov 2026 14:58:12 +0100 Subject: [PATCH 12/15] Docking: drop DockConfig::menu_button, which next's panel_menu_always covers next gained DockConfig::panel_menu_always (with its trial a_dock_that_shows_the_panel_menu_always_gives_every_group_the_button), the same choice this branch added as menu_button. The duplicate option, its GroupMenuButton type, its trial and its docs row go; the dock reads only panel_menu_always. --- crates/ui-panels/src/docking/config.rs | 22 ------------- crates/ui-panels/src/docking/mod.rs | 2 +- crates/ui-patterns/src/patterns/dock/area.rs | 6 ++-- .../tests/it/docking/panel_menu.rs | 33 +------------------ docs/ui-docking.md | 1 - 5 files changed, 5 insertions(+), 59 deletions(-) diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index d94ba6224..d3b885867 100644 --- a/crates/ui-panels/src/docking/config.rs +++ b/crates/ui-panels/src/docking/config.rs @@ -115,20 +115,6 @@ pub struct DockConfig { /// What the icons of a docked column collapsed to icons open: flyouts, or with [`IconicMode::Rail`] the column /// itself, whose icons then stay beside it while it is expanded. Floating windows' icons open flyouts. pub iconic_mode: IconicMode, - /// Which groups show the panel menu button at the end of their tab strip. - pub menu_button: GroupMenuButton, -} - -/// Which groups show the panel menu button at the end of their tab strip ([`DockConfig::menu_button`]). -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] -#[non_exhaustive] -pub enum GroupMenuButton { - /// Only a group whose shown panel has host rows (`DockPanels::panel_rows`) shows the button; the dock's rows open - /// from a context request on a tab. - #[default] - HostRows, - /// Every group shows the button, listing the dock's rows when the host has none for its panel. - EveryGroup, } impl Default for DockConfig { @@ -155,7 +141,6 @@ impl Default for DockConfig { panel_menu_always: false, panel_menu_icon: IconId::new("more"), iconic_mode: IconicMode::Flyouts, - menu_button: GroupMenuButton::HostRows, } } } @@ -168,13 +153,6 @@ impl DockConfig { self } - /// Which groups show the panel menu button. - #[must_use] - pub fn menu_button(mut self, shown: GroupMenuButton) -> Self { - self.menu_button = shown; - self - } - /// The Minimize and Move Group Up and Down items of docked groups' menus on or off. #[must_use] pub fn group_order_items(mut self, on: bool) -> Self { diff --git a/crates/ui-panels/src/docking/mod.rs b/crates/ui-panels/src/docking/mod.rs index 5c3c11a72..37ceceb30 100644 --- a/crates/ui-panels/src/docking/mod.rs +++ b/crates/ui-panels/src/docking/mod.rs @@ -30,7 +30,7 @@ mod commands; pub mod cross_window; pub mod native; -pub use config::{DockConfig, DockSides, GroupMenuButton}; +pub use config::{DockConfig, DockSides}; #[doc(hidden)] pub use drop::{Arrangement, end_replaced_drags}; pub use drop::{DockDrag, DockDropTarget, DockDropped, DragUnit, float_drop, resolve_drop, start_group_drag, start_icon_drag}; diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 39c6a4f35..c8f50a75a 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -15,8 +15,8 @@ use crate::docking::{Arrangement, close_requests, cross_window, end_replaced_dra use crate::docking::{ ColumnArrow, ColumnBar, DockColumn, DockCommands, DockConfig, DockDropTarget, DockDropped, DockEvent, DockGroup, DockPanels, DockRoot, DockScene, DockSizes, DockSpot, DockTargets, DockTo, DockWords, DragUnit, FloatSpace, FloatingGroup, FlyoutResize, GroupAt, GroupDrag, GroupGrip, - GroupMenuButton, HidePanels, IconicColumn, IconicMode, IconicSizes, PanelDrag, PanelKey, PanelSpec, PanelSpecs, PanelTitle, Placing, SpecSource, - SplitArea, Titles, WindowColumn, actions, dock_states, fit_widths, frame, move_actions, + HidePanels, IconicColumn, IconicMode, IconicSizes, PanelDrag, PanelKey, PanelSpec, PanelSpecs, PanelTitle, Placing, SpecSource, SplitArea, + Titles, WindowColumn, actions, dock_states, fit_widths, frame, move_actions, }; use crate::layout_components::Stack; use crate::menu::{GroupItem, MenuWords, PanelMenu, PanelRow}; @@ -1102,7 +1102,7 @@ impl Pass<'_, P> { .zones(scene.config.zone_rule()) .movable(scene.permissions(shown).movable) .menu(move || panel_menu_rows(scene, &mut **panels.borrow_mut(), words, shown).0) - .panel_menu_shown(*hosted || scene.config.panel_menu_always || scene.config.menu_button == GroupMenuButton::EveryGroup) + .panel_menu_shown(*hosted || scene.config.panel_menu_always) .panel_menu_icon(scene.config.panel_menu_icon.clone()) .tab_look(scene.config.tab_look) .command_states(states.clone()); diff --git a/crates/ui-patterns/tests/it/docking/panel_menu.rs b/crates/ui-patterns/tests/it/docking/panel_menu.rs index 327ffa176..e2bd8fa7a 100644 --- a/crates/ui-patterns/tests/it/docking/panel_menu.rs +++ b/crates/ui-patterns/tests/it/docking/panel_menu.rs @@ -5,7 +5,7 @@ use craft_behavior::Axis; use craft_behavior::PartKey; use craft_behavior::dock::{Action, Column, DockEdge, Group, Layout, Node, SplitSize, Workspace}; use craft_ui::contract::{Bind, BodyCx, PlainData, Role, ShowContainer as _, Tracked}; -use craft_ui::docking::{DockConfig, DockPanels, GroupMenuButton, PanelSpec, PanelSpecs, WindowMenuRows}; +use craft_ui::docking::{DockConfig, DockPanels, PanelSpec, PanelSpecs, WindowMenuRows}; use craft_ui::menu::{Menu, PanelRow}; use craft_ui::patterns::dock::DockArea; use craft_ui::testing::{Fixture, Target, trial}; @@ -179,34 +179,3 @@ fn a_window_floated_after_an_undo_takes_a_new_id() { assert_eq!(ids.len(), 1, "Float made a window again"); assert_ne!(ids, undone, "the window after the undo does not take the undone window's id"); } - -/// With `GroupMenuButton::EveryGroup`, a group whose panel has no host rows still shows the panel menu button, and its -/// menu lists the dock's rows; with the default `GroupMenuButton::HostRows` the group shows none. -#[trial] -fn the_menu_button_config_shows_the_panel_menu_without_host_rows() { - assert_eq!(DockConfig::default().menu_button, GroupMenuButton::HostRows, "by default only groups with host rows show the button"); - for button in [GroupMenuButton::HostRows, GroupMenuButton::EveryGroup] { - let root = Node::split(Axis::X, SplitSize::Ratio(0.5), Node::tabs(vec![0, 1], 0), Node::tabs(vec![2], 0)); - let workspace = Rc::new(RefCell::new(Arc::new(Workspace::new(Layout::new(Some(root), Vec::new()))))); - let (held, specs) = (Rc::clone(&workspace), Tracked::new(Specs)); - let mut fixture = Fixture::new(move |ui| { - let mut shown = held.borrow().clone(); - DockArea::new("Dock", Bind::bound(&mut shown), &specs, &mut Bare, DockConfig::default().menu_button(button)).show(ui); - *held.borrow_mut() = shown; - }); - fixture.room(Vec2::new(1200.0, 600.0)).settle(); - let buttons: Vec<_> = - fixture.by_role(Role::BUTTON).into_iter().filter(|button| fixture.tree().name_of(button.node) == Some("Panel Menu")).collect(); - if button == GroupMenuButton::HostRows { - assert!(buttons.is_empty(), "without host rows and with only host-row groups showing it, no group shows the button"); - continue; - } - assert_eq!(buttons.len(), 2, "each group shows its panel menu button"); - fixture.click(&buttons[1]).idle(2); - let float = fixture.by_label("Float").expect("the menu lists the dock's Float row"); - fixture.click(&float).idle(2); - let shown = workspace.borrow(); - let floated: Vec = shown.layout().floating.iter().flat_map(|window| window.panels().copied().collect::>()).collect(); - assert_eq!(floated, vec![2], "the dock's row runs for the group whose button opened the menu"); - } -} diff --git a/docs/ui-docking.md b/docs/ui-docking.md index 90d391486..6eeaf8600 100644 --- a/docs/ui-docking.md +++ b/docs/ui-docking.md @@ -104,7 +104,6 @@ The host handles these `DockEvent`s: | `tab_close_buttons` | off | Close buttons on tabs (middle click closes too), for tabs that act as documents. | | `panel_menu_always` | off | Every group shows its panel menu button, with the dock's own rows when the shown panel has none. Off: only a panel with rows of its own (`DockPanels::panel_rows`) gets the button. | | `panel_menu_icon` | `more` | The panel menu button's icon; `menu` gives the three-line mark. | -| `menu_button` | `GroupMenuButton::HostRows` | Which groups show the panel menu button: only those whose shown panel has host rows (`DockPanels::panel_rows`), or with `EveryGroup` every group, its menu listing the dock's rows when the host has none. | | `native_windows` | on | Floating windows open as OS windows where the window host opens them and reports their positions (not on Wayland) and `PanelSpec::allow_native` allows. | The theme's docking sizes (`DockSizes`) set the drop bands and zones. `DockWords` holds the words. From 6624de3719dfc65a2f869c5e77f116e373d588da Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 24 Nov 2026 17:42:21 +0100 Subject: [PATCH 13/15] Iconic trials: a type alias for the tall-flyout fixture's parts --- crates/ui-panels/src/docking/iconic/trials.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index b039132bc..1a3553024 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -429,10 +429,14 @@ const ROOM_BELOW: f32 = 200.0; /// How much shorter than that room the body of the flyout that fits measures, and how much taller the one that does not. const OVERFLOW: f32 = 40.0; +/// What [`tall_flyouts`] returns: the fixture, the panel whose flyout is open (the trial sets it) and the rect the open +/// flyout's body showed in, last pass. +type TallFlyouts = (Fixture, Rc>>, Rc>>); + /// A column of the [`TALL`] panels, each in a group of its own, on the left window edge; its flyouts stay inside the /// bounds `within` holds and their bodies measure the height `body` holds. Returns the fixture, the panel whose flyout /// is open (the trial sets it) and the rect the open flyout's body showed in, last pass. -fn tall_flyouts(within: &Rc>, body: &Rc>) -> (Fixture, Rc>>, Rc>>) { +fn tall_flyouts(within: &Rc>, body: &Rc>) -> TallFlyouts { let (open, shown) = (Rc::new(Cell::new(None)), Rc::new(Cell::new(None))); let (bounds, measures, now, seen) = (Rc::clone(within), Rc::clone(body), Rc::clone(&open), Rc::clone(&shown)); let mut column = Column::new((0..TALL.len() as u8).map(|panel| Group::new(vec![panel], 0)).collect()); From 82a4dd93af80352c16b0cac197b228130bcea9d3 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Wed, 25 Nov 2026 15:21:19 +0100 Subject: [PATCH 14/15] Dividers: the column bar and margin handles take key focus on a press again Splitter dividers keep key focus where it was on a press, but the pages column bar and margin handles share the same declare and lost press focus with it, so a click on a column bar divider no longer let the arrow keys step it (the pages setup trial an_arrow_moves_the_focused_divider_one_step_and_shift_ten failed). divider::declare_focusing declares a divider whose press takes focus, as next's declare did, and the two value controls use it. --- crates/pages/src/ui/column_bar.rs | 2 +- crates/pages/src/ui/margins.rs | 2 +- crates/ui-panels/src/docking/divider.rs | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/pages/src/ui/column_bar.rs b/crates/pages/src/ui/column_bar.rs index 3568d6c6c..0d1c87e50 100644 --- a/crates/pages/src/ui/column_bar.rs +++ b/crates/pages/src/ui/column_bar.rs @@ -232,7 +232,7 @@ impl Component for ColumnBar<'_> { start = end; } for (at, divider) in dividers(&shares, rect, cx.style.grab) { - divider::declare(cx, rect, DIVIDER, at, ÷r); + divider::declare_focusing(cx, rect, DIVIDER, at, ÷r); } } diff --git a/crates/pages/src/ui/margins.rs b/crates/pages/src/ui/margins.rs index efcf5c34d..4325c9ab3 100644 --- a/crates/pages/src/ui/margins.rs +++ b/crates/pages/src/ui/margins.rs @@ -458,7 +458,7 @@ impl Component for MarginHandles<'_> { let (grab, strip) = (cx.style.grab, cx.style.strip); let words = cx.words::(); for &visible in self.edges_shown() { - divider::declare(cx, rect, EDGE, visible.index(), &self.divider(&rules, visible, rect, (grab, strip))) + divider::declare_focusing(cx, rect, EDGE, visible.index(), &self.divider(&rules, visible, rect, (grab, strip))) .tooltip(visible.name(&words).clone()); } } diff --git a/crates/ui-panels/src/docking/divider.rs b/crates/ui-panels/src/docking/divider.rs index 2d7e03306..73443a597 100644 --- a/crates/ui-panels/src/docking/divider.rs +++ b/crates/ui-panels/src/docking/divider.rs @@ -2,7 +2,7 @@ //! its accessibility node. A container describes each divider as a [`Divider`] in reading order and applies the //! coordinate the drag or the keys ask for; this module owns everything that is the same for all of them, including //! the mirroring for right-to-left. A component that draws its own dividers (a column bar, a margin handle) calls -//! [`declare`] in its parts, `pointer` and [`keys`] in its update, and [`describe`] in its access, and declares `KeyUse::SPLITTER` for the arrow keys. +//! [`declare_focusing`] in its parts, `pointer` and [`keys`] in its update, and [`describe`] in its access, and declares `KeyUse::SPLITTER` for the arrow keys. use crate::contract::{Access, Component, Cx, Focus as _, Name, Numeric, PartBuilder, PartsCx, Pointer as _, Role}; use craft_behavior::dock::DockEdge; @@ -107,6 +107,12 @@ pub fn declare<'a, C: Component>(cx: &'a mut PartsCx<'_, C>, rect: Rect, key: Pa .over() } +/// [`declare`] for a value control drawn with dividers (a column bar, a margin handle) rather than a splitter between +/// panes: a press on the divider takes key focus, so the arrow keys after a click step it. +pub fn declare_focusing<'a, C: Component>(cx: &'a mut PartsCx<'_, C>, rect: Rect, key: PartKey, index: u64, divider: &Divider) -> PartBuilder<'a> { + declare(cx, rect, key, index, divider).sense(Sense::DRAG | Sense::TAKE_FOCUS) +} + /// What the pointer did to the divider `key.at(index)` this pass. pub fn pointer(cx: &Cx<'_, C>, key: PartKey, index: u64, divider: &Divider) -> Option { drag(cx.part(key.at(index)).press.phase, cx.rect, cx.flow.is_rtl(), divider) From 84febd99384e0bb24504539b1743e895a5f3f5ee Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Wed, 25 Nov 2026 15:58:07 +0100 Subject: [PATCH 15/15] docs: regenerate contract-api.md --- docs/contract-api.md | 368 +++++++++++++++++++++++++++++++++---------- 1 file changed, 285 insertions(+), 83 deletions(-) diff --git a/docs/contract-api.md b/docs/contract-api.md index b186ce473..47813e168 100644 --- a/docs/contract-api.md +++ b/docs/contract-api.md @@ -57,6 +57,7 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `craft_behavior::ColumnWidth`: re-export of `craft_behavior::columns::ColumnWidth`. - `craft_behavior::CommandFlags`: re-export of `craft_behavior::command::CommandFlags`. - `craft_behavior::ControlMetrics`: re-export of `craft_behavior::sizing::ControlMetrics`. +- `craft_behavior::CopyKeys`: re-export of `craft_behavior::keys::CopyKeys`. - `craft_behavior::CountMark`: re-export of `craft_behavior::cursor::CountMark`. - `craft_behavior::Cursor`: re-export of `craft_behavior::cursor::Cursor`. - `craft_behavior::CursorBadge`: re-export of `craft_behavior::cursor::CursorBadge`. @@ -79,6 +80,7 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `craft_behavior::Ended`: re-export of `craft_behavior::typing::Ended`. - `craft_behavior::EscapeRule`: re-export of `craft_behavior::typing::EscapeRule`. - `craft_behavior::Escaped`: re-export of `craft_behavior::typing::Escaped`. +- `craft_behavior::FRAME_STEP_MAX`: re-export of `craft_behavior::frame_step::FRAME_STEP_MAX`. - `craft_behavior::Flow`: re-export of `craft_behavior::flow::Flow`. - `craft_behavior::FreeLayout`: re-export of `craft_behavior::item_layout::FreeLayout`. - `craft_behavior::GESTURE_GAP`: re-export of `craft_behavior::wheel::GESTURE_GAP`. @@ -112,6 +114,8 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `craft_behavior::MarqueeMode`: re-export of `craft_behavior::item_marquee::MarqueeMode`. - `craft_behavior::MarqueeSelect`: re-export of `craft_behavior::item_marquee::MarqueeSelect`. - `craft_behavior::Metrics`: re-export of `craft_behavior::sizing::Metrics`. +- `craft_behavior::MiddleButton`: re-export of `craft_behavior::middle_scroll::MiddleButton`. +- `craft_behavior::MiddleScroll`: re-export of `craft_behavior::middle_scroll::MiddleScroll`. - `craft_behavior::Mixed`: re-export of `craft_behavior::value::Mixed`. - `craft_behavior::Monitor`: re-export of `craft_behavior::monitor::Monitor`. - `craft_behavior::MonitorKey`: re-export of `craft_behavior::monitor::MonitorKey`. @@ -169,16 +173,19 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `craft_behavior::PointerSample`: re-export of `craft_behavior::press::PointerSample`. - `craft_behavior::Positions`: `pub struct Positions`. The display order of a grid whose row keys are their positions (a sheet, a document table): `key(at) == at`, and - `pub const fn new(rows: u32) -> Self`. The order of `rows` rows. +- `craft_behavior::PressAside`: re-export of `craft_behavior::press::PressAside`. - `craft_behavior::PressCancel`: re-export of `craft_behavior::press::PressCancel`. - `craft_behavior::PressFocus`: re-export of `craft_behavior::focus::PressFocus`. - `craft_behavior::PressMachine`: re-export of `craft_behavior::press::PressMachine`. - `craft_behavior::PressPhase`: re-export of `craft_behavior::press::PressPhase`. +- `craft_behavior::PressPick`: re-export of `craft_behavior::press::PressPick`. - `craft_behavior::PressStart`: re-export of `craft_behavior::press::PressStart`. - `craft_behavior::PressState`: re-export of `craft_behavior::press::PressState`. - `craft_behavior::PressStep`: re-export of `craft_behavior::press::PressStep`. - `craft_behavior::Preview`: re-export of `craft_behavior::value::Preview`. - `craft_behavior::Proposal`: re-export of `craft_behavior::sizing::Proposal`. - `craft_behavior::Reader`: re-export of `craft_behavior::quantity::Reader`. +- `craft_behavior::ReorderKeys`: re-export of `craft_behavior::keys::ReorderKeys`. - `craft_behavior::ResolveFor`: re-export of `craft_behavior::hit::ResolveFor`. - `craft_behavior::RoleRule`: re-export of `craft_behavior::role_rule::RoleRule`. - `craft_behavior::Roving`: `pub struct Roving { pub shape: NavShape, pub wrap: bool, pub home_end: bool, pub page: Option, pub letters: Letters, pub arrows: Arrows, pub first_column: Option, pub hands_back: bool, pub no_lead: bool, pub keeps_lead_moves: bool }`. A roving group's rules: one Tab stop whose members take moves. @@ -195,13 +202,14 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `pub const fn state(&self, lead: Option) -> NavState`. The state a step over this group starts from, at `lead`, or from no lead when the group has none. - `pub const fn takes(&self, mv: NavMove, mods: MoveMods) -> bool`. Whether the group handles `mv` with `mods`: Page moves only with a page size and without `lead` (on a document - `craft_behavior::RowAt`: re-export of `craft_behavior::selection::RowAt`. -- `craft_behavior::RulerUnits`: `pub struct RulerUnits { pub per_doc: f64, pub ticks: Ticks }`. The ruler unit of one document axis: its size and its ticks. Rulers label their ticks with it; guides use it for - - `pub const fn new(per_doc: f64, ticks: Ticks) -> Self`. Ruler units of `per_doc` per document unit, spaced by `ticks`. +- `craft_behavior::RulerUnits`: `pub struct RulerUnits { pub per_doc: f64, pub ticks: Ticks, pub labels: TickLabels }`. The ruler unit of one document axis: its size, its ticks and how it labels them. Rulers label their ticks with it; + - `pub const fn new(per_doc: f64, ticks: Ticks) -> Self`. Ruler units of `per_doc` per document unit, spaced by `ticks`, labelled as [`TickLabels::Distance`]. + - `pub const fn with_labels(mut self, labels: TickLabels) -> Self`. The units with their ticks written as `labels`. - `pub const fn pixels() -> Self`. Whole document pixels. - `pub fn step(&self, zoom: f64, step_min: f32) -> (f64, u32)`. The labelled step in ruler units and its subdivisions when one document unit is `zoom` screen points along - `pub fn snap_to_tick(&self, position: f64, zero: f64, zoom: f64, step_min: f32) -> f64`. `position` (document units) moved to the nearest minor tick of the ruler counting from `zero`, at `zoom` - `pub fn distance(&self, position: f64, zero: f64) -> f64`. The distance of `position` (document units) from `zero`, in ruler units. - - `pub fn label_decimals(&self, step: f64) -> usize`. The decimals a ruler writes a tick of labelled step `step` with. Whole ticks are whole numbers; a step of at + - `pub fn label_decimals(&self, step: f64) -> RangeInclusive`. The least and most decimals a ruler writes a tick of labelled step `step` with. Whole ticks are whole numbers; - `pub fn label_value(&self, value: f64, step: f64) -> f64`. The number a ruler prints at the tick `value` (ruler units from the zero point) for a labelled step `step`: - `craft_behavior::SHEET_ZOOM`: re-export of `craft_behavior::item_layout::SHEET_ZOOM`. - `craft_behavior::ScopeKind`: re-export of `craft_behavior::focus::ScopeKind`. @@ -218,6 +226,7 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `craft_behavior::SpanLayout`: re-export of `craft_behavior::item_layout::SpanLayout`. - `craft_behavior::SurroundingUnit`: re-export of `craft_behavior::editor::SurroundingUnit`. - `craft_behavior::TextPos`: re-export of `craft_behavior::intent::TextPos`. +- `craft_behavior::TickLabels`: `pub enum TickLabels { Distance, Signed }`. How a ruler writes the number at a labelled tick. - `craft_behavior::Ticks`: `pub enum Ticks { Decimal { whole: bool }, Custom(fn(f64) -> (f64, u32)) }`. How a ruler divides its unit at a zoom. - `pub const fn decimal(whole: bool) -> Self`. PhotoCraft's decimal steps; `whole` keeps the step a whole number of units without 2.5. - `craft_behavior::TileLayout`: re-export of `craft_behavior::item_layout::TileLayout`. @@ -238,6 +247,7 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `craft_behavior::ViewPlace`: `pub struct ViewPlace { pub key: K, pub center: Point, pub zoom: f64 }`. Where a view stood: what it showed (`key`: a page, an artboard, a document) and the view's - `pub const fn new(key: K, center: Point, zoom: f64) -> Self`. The view of `key` centred on `center` at `zoom`. - `craft_behavior::Wheel`: re-export of `craft_behavior::wheel::Wheel`. +- `craft_behavior::WheelEase`: re-export of `craft_behavior::wheel::WheelEase`. - `craft_behavior::WheelFocus`: re-export of `craft_behavior::wheel::WheelFocus`. - `craft_behavior::WheelGesture`: re-export of `craft_behavior::wheel::WheelGesture`. - `craft_behavior::WheelNotch`: re-export of `craft_behavior::wheel::WheelNotch`. @@ -251,6 +261,7 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `craft_behavior::ZoomScheme`: re-export of `craft_behavior::canvas::zoom::ZoomScheme`. - `craft_behavior::count_clicks`: re-export of `craft_behavior::press::count_clicks`. - `craft_behavior::decimals_for_step`: re-export of `craft_behavior::codec::decimals_for_step`. +- `craft_behavior::frame_step`: re-export of `craft_behavior::frame_step::frame_step`. - `craft_behavior::is_checkable`: re-export of `craft_behavior::role_rule::is_checkable`. - `craft_behavior::is_selectable`: re-export of `craft_behavior::role_rule::is_selectable`. - `craft_behavior::keyed`: re-export of `craft_behavior::item_source::keyed`. @@ -312,14 +323,16 @@ The transform a canvas body is shown through, and the canvas view with its zoom - `pub fn layer_transform(&self) -> Option`. The transform a canvas body is shown through when this view only scales and moves the document: unturned, - `pub fn axis_aligned(&self) -> bool`. Whether the rotation is a multiple of 90°, so document axes are screen axes. - `pub fn level(&self, zero: Point) -> CanvasView`. The view without its rotation, moved so it draws `zero` where this view does: the same -- `craft_behavior::canvas::RulerUnits`: `pub struct RulerUnits { pub per_doc: f64, pub ticks: Ticks }`. The ruler unit of one document axis: its size and its ticks. Rulers label their ticks with it; guides use it for - - `pub const fn new(per_doc: f64, ticks: Ticks) -> Self`. Ruler units of `per_doc` per document unit, spaced by `ticks`. +- `craft_behavior::canvas::RulerUnits`: `pub struct RulerUnits { pub per_doc: f64, pub ticks: Ticks, pub labels: TickLabels }`. The ruler unit of one document axis: its size, its ticks and how it labels them. Rulers label their ticks with it; + - `pub const fn new(per_doc: f64, ticks: Ticks) -> Self`. Ruler units of `per_doc` per document unit, spaced by `ticks`, labelled as [`TickLabels::Distance`]. + - `pub const fn with_labels(mut self, labels: TickLabels) -> Self`. The units with their ticks written as `labels`. - `pub const fn pixels() -> Self`. Whole document pixels. - `pub fn step(&self, zoom: f64, step_min: f32) -> (f64, u32)`. The labelled step in ruler units and its subdivisions when one document unit is `zoom` screen points along - `pub fn snap_to_tick(&self, position: f64, zero: f64, zoom: f64, step_min: f32) -> f64`. `position` (document units) moved to the nearest minor tick of the ruler counting from `zero`, at `zoom` - `pub fn distance(&self, position: f64, zero: f64) -> f64`. The distance of `position` (document units) from `zero`, in ruler units. - - `pub fn label_decimals(&self, step: f64) -> usize`. The decimals a ruler writes a tick of labelled step `step` with. Whole ticks are whole numbers; a step of at + - `pub fn label_decimals(&self, step: f64) -> RangeInclusive`. The least and most decimals a ruler writes a tick of labelled step `step` with. Whole ticks are whole numbers; - `pub fn label_value(&self, value: f64, step: f64) -> f64`. The number a ruler prints at the tick `value` (ruler units from the zero point) for a labelled step `step`: +- `craft_behavior::canvas::TickLabels`: `pub enum TickLabels { Distance, Signed }`. How a ruler writes the number at a labelled tick. - `craft_behavior::canvas::Ticks`: `pub enum Ticks { Decimal { whole: bool }, Custom(fn(f64) -> (f64, u32)) }`. How a ruler divides its unit at a zoom. - `pub const fn decimal(whole: bool) -> Self`. PhotoCraft's decimal steps; `whole` keeps the step a whole number of units without 2.5. - `craft_behavior::canvas::ViewHistory`: `pub struct ViewHistory`. The places a window jumped between, oldest first, with the one it shows now. The app records @@ -384,6 +397,8 @@ Zoom rules as pure functions on a [`CanvasView`]: the zoom scheme's range and Zo - `pub fn new(reader: Reader, decimals: usize) -> Self`. A codec reading with `reader` and writing at most `decimals` decimal places. - `pub fn fixed(mut self) -> Self`. The same codec writing every decimal place, trailing zeros included ("1.00"), as a field of a quantity shown - `pub fn zoom_typing(mut self) -> Self`. The same codec with the typing rules of a zoom field: digits, `/` and the decimal separator, `a/b` as the + - `pub fn signed_zoom(mut self) -> Self`. Allow a leading minus in zoom input so the field can reject negative values instead of discarding the sign. + - `pub fn share_of_start(mut self) -> Self`. The same codec reading a lone percentage (`50%`, [`Reader::share`]) as that share of the value the edit - `pub fn at_most(mut self, decimals: usize) -> Self`. The same codec writing at most `decimals` decimal places. - `pub fn or_parse(mut self, parse: impl Fn(&str) -> Option + Send + Sync + 'static) -> Self`. The same codec with `parse` as a second reader: it runs when the reader rejects the text, so words of the - `pub fn widest(&self, range: &RangeInclusive) -> String`. The widest text the codec writes for a number in `range`: the longest of each end and the number one place of @@ -429,11 +444,11 @@ Cursor requests as plain data and the rule that picks the winner (8.5). - `craft_behavior::cursor::Cursor`: `pub enum Cursor { System(CursorIcon), Painted(PaintedCursor) }`. What a cursor request names. - `craft_behavior::cursor::CursorBadge`: `pub enum CursorBadge { Add, Subtract, Intersect, Copy, NotAllowed, Scissors, Close, Move, Arrow, Target, Continue, Count(CountMark), Corner }`. A mark beside a painted cursor. - `craft_behavior::cursor::CursorIcon`: `pub enum CursorIcon { Default, None, ContextMenu, Help, PointingHand, Progress, Wait, Cell, Crosshair, Text, VerticalText, Alias, Copy, Move, NoDrop, NotAllowed, Grab, Grabbing, AllScroll, ResizeHorizontal, ResizeNeSw, ResizeNwSe, ResizeVertical, ResizeColumn, ResizeEast, ResizeSouthEast, ResizeSouth, ResizeSouthWest, ResizeWest, ResizeNorthWest, ResizeNorth, ResizeNorthEast, ZoomIn, ZoomOut }`. A system cursor: craft-behavior's copy of egui's set, converted by `runtime::egui::output`. -- `craft_behavior::cursor::CursorPriority`: `pub enum CursorPriority { Default, Tool, Hover, Part, DropTarget, Drag }`. Who asks, in ascending order of precedence. +- `craft_behavior::cursor::CursorPriority`: `pub enum CursorPriority { Default, Tool, Hover, Part, DropTarget, Drag, Hidden }`. Who asks, in ascending order of precedence. - `craft_behavior::cursor::IconId`: `pub struct IconId`. An icon's egui-free key (5.2), so plain data such as [`PaintedCursor::Tool`] names icons without egui. - `pub const fn new(name: &'static str) -> Self`. The icon named `name`. - `pub fn name(&self) -> &str`. The name. -- `craft_behavior::cursor::PaintedCursor`: `pub enum PaintedCursor { Crosshair, Circle { radius: f32, centre: bool, badge: Option }, Outline { rings: Vec>, centre: bool, badge: Option }, Hand, Zoom { out: bool }, Tool { icon: IconId, hotspot: Vec2, badge: Option }, Badged { base: CursorIcon, badge: CursorBadge }, Turn { toward: Vec2 }, Distort { dir: Vec2 }, Skew { dir: Vec2 }, TypeOn { path: bool }, Locator, Arrow { hollow: bool, toward: Option }, PathText { start: bool, end: bool }, PointerTool { pointer: PointerGlyph, icon: IconId }, Hidden, IBeam }`. A cursor the overlay host paints. Geometry is in screen points around the pointer (a tool scales its brush +- `craft_behavior::cursor::PaintedCursor`: `pub enum PaintedCursor { Crosshair, Circle { radius: f32, centre: bool, badge: Option }, Outline { rings: Vec>, centre: bool, badge: Option }, Hand, Zoom { out: bool }, Tool { icon: IconId, hotspot: Vec2, badge: Option }, Badged { base: CursorIcon, badge: CursorBadge }, Turn { toward: Vec2 }, Distort { dir: Vec2 }, Skew { dir: Vec2 }, TypeOn { path: bool }, Locator, Arrow { hollow: bool, toward: Option }, PathText { start: bool, end: bool }, PointerTool { pointer: PointerGlyph, icon: IconId, badge: Option }, Hidden, IBeam }`. A cursor the overlay host paints. Geometry is in screen points around the pointer (a tool scales its brush - `pub const CENTRE_ARM: f32`. The arm of the centre mark of a circle or an outline, in points. - `pub const fn circle(radius: f32) -> Self`. A circle of `radius` points, with no centre mark and no badge. - `pub fn outline(rings: Vec>) -> Self`. App shapes as closed rings, with no centre mark and no badge. @@ -448,6 +463,7 @@ Cursor requests as plain data and the rule that picks the winner (8.5). - `pub const fn arrow_toward(dir: Vec2) -> Self`. A solid arrow turned about its hotspot to point along `dir`. - `pub const fn path_text(start: bool, end: bool) -> Self`. An I-beam across the path with a triangle toward each grabbable side. - `pub const fn pointer_tool(pointer: PointerGlyph, icon: IconId) -> Self`. `pointer` with the tool's icon below and right of it. + - `pub const fn pointer_tool_badged(pointer: PointerGlyph, icon: IconId, badge: Option) -> Self`. `pointer` with the tool's icon below and right of it, and `badge` at the icon's lower right. - `pub const fn badged(base: CursorIcon, badge: CursorBadge) -> Self`. A system cursor with a mark. - `craft_behavior::cursor::PointerGlyph`: `pub enum PointerGlyph { Crosshair, Arrow }`. The pointer of a [`PaintedCursor::PointerTool`]. - `craft_behavior::cursor::pick`: `pub fn pick(requests: &[(Cursor, CursorPriority)]) -> Option<&Cursor>`. The winning request: the highest priority, the later request on a tie. @@ -655,7 +671,7 @@ The dock model: the tree of splits over panel frames, the side of a group a drop - `craft_behavior::edit_history::EditHistory`: `pub struct EditHistory`. Undo and redo stacks of a value `T`, at most 100 steps. A gesture is one step: `Begin` opens it, `Commit` closes it, - `pub fn new(now: &T) -> Self`. A history that starts at `now`. - `pub fn with_budget(mut self, max: usize, weight: fn(&T) -> usize) -> Self`. The undo steps' summed weight stays at or under `max`: after each push the oldest go first, the newest always - - `pub fn record(&mut self, event: &EditEvent)`. Takes in one event. Events of a gesture other than the open one are ignored. + - `pub fn record(&mut self, event: &EditEvent)`. Takes in one event. Events of a gesture other than the open one are ignored. A concrete - `pub fn is_open(&self) -> bool`. A gesture is open: a caller that restores a draft waits for it to end. - `pub fn step(&mut self, now: &mut T, step: Step) -> bool`. Steps `now` back or forward. False when there is nowhere to go. An open gesture is abandoned. - `pub fn take_back(&mut self) -> Option`. Takes back the newest undo step without a redo entry, for an edit that was refused: `settled` returns to the @@ -748,6 +764,13 @@ Pure focus rules (spec 9.3, 9.4, 8.3): key ownership, the Escape order and the f - `craft_behavior::focus::key_owner`: `pub fn key_owner(blocked: bool, present: &[OwnerClass]) -> KeyOwner`. Key ownership, in the order blocked, `Menu`, `Recorder`, `Dialog`, `Text`, `Popup` and `PassivePopup`, - `craft_behavior::focus::route_escapes`: `pub fn route_escapes(escapes: usize, press_captured: bool) -> EscapeRouting`. Routes `escapes` Escapes of one pass: with a press captured, the first one is the press's (`escape_step`'s +## `craft_behavior::frame_step` + +The step of one pass of motion: a Hand glide, a held Zoom press and an autoscroll integrate over it. + +- `craft_behavior::frame_step::FRAME_STEP_MAX`: `pub const FRAME_STEP_MAX: f64`. The longest step motion integrates, in seconds, so a stalled pass never jumps the view. +- `craft_behavior::frame_step::frame_step`: `pub fn frame_step(dt: f64) -> f64`. The step of a pass that came `dt` seconds after the previous one, `dt` being the time between two readings of the + ## `craft_behavior::geometry` Pure canvas geometry in document units: the transform box ([`quad`]), snapping ([`snap`]), the @@ -756,6 +779,7 @@ Pure canvas geometry in document units: the transform box ([`quad`]), snapping ( - `craft_behavior::geometry::AspectHold`: re-export of `craft_behavior::geometry::crop::AspectHold`. - `craft_behavior::geometry::BoxAllow`: re-export of `craft_behavior::geometry::quad::BoxAllow`. - `craft_behavior::geometry::BoxDrag`: re-export of `craft_behavior::geometry::quad::BoxDrag`. +- `craft_behavior::geometry::BoxHandles`: re-export of `craft_behavior::geometry::quad::BoxHandles`. - `craft_behavior::geometry::BoxPart`: re-export of `craft_behavior::geometry::quad::BoxPart`. - `craft_behavior::geometry::BoxRules`: re-export of `craft_behavior::geometry::quad::BoxRules`. - `craft_behavior::geometry::BoxState`: re-export of `craft_behavior::geometry::quad::BoxState`. @@ -830,7 +854,7 @@ The crop frame's pure geometry: the box, where a press lands on it, what each ge - `pub fn swapped(&self) -> Self`. Width and height swapped about the centre, the angle kept (X). - `pub fn nudged(&self, part: BoxPart, by: Vec2, ratio: Option) -> Self`. The frame after an arrow key moves `part` by `by`, as a plain drag of the part would, with `ratio` held. - `pub fn crop_size(&self) -> Option<(f64, f64)>`. The size Enter would crop to: the frame's own width and height in whole document units, at least 1; `None` - - `pub fn size_ok(&self) -> bool`. Whether both sides are at least one document unit. + - `pub fn size_ok(&self, min: f64) -> bool`. Whether both sides are at least `min`, and never under one document unit whatever `min` says (a `min` that is - `pub fn resized(&self, part: BoxPart, by: Vec2, hold: AspectHold, alt: bool) -> Self`. The frame with `part` dragged by the page vector `by`: along the frame's own axes, the opposite edges kept on - `pub fn resized_centred(&self, part: BoxPart, by: Vec2, hold: AspectHold, alt: bool) -> Option`. [`resized`](Self::resized) for Auto Center Preview in image mode: `part` dragged by `by` grows or shrinks the - `pub fn turned_to(&self, grab: f64, to: Point, step: Option, image: bool) -> Self`. The frame turned from this one's angle by the pointer's sweep about the centre, from direction `grab` @@ -967,15 +991,19 @@ Box geometry of transform boxes: where the box goes when a part of it is dragged - `pub const fn new(rotate: bool, skew: bool, distort: bool) -> Self`. What the content allows: turning, skewing and distorting. - `pub const fn with_warp(mut self, warp: bool) -> Self`. Whether the content allows warping. - `craft_behavior::geometry::quad::BoxDrag`: `pub enum BoxDrag { Move, Pivot, Rotate, Scale, Distort, Perspective, Skew, SlideCorner }`. What a drag of a box part does ([`BoxRules::drag_kind`]). +- `craft_behavior::geometry::quad::BoxHandles`: `pub enum BoxHandles { All, Corners, Sides }`. Which handles of a box are shown. - `craft_behavior::geometry::quad::BoxPart`: `pub enum BoxPart { Corner(u8), Edge(u8), Pivot, Inside, Outside }`. A part of a box under the pointer or picked from the keyboard. Edge `k` joins corners `k` and - `pub const fn index(self) -> u64`. The number a part is keyed by in a canvas control's part keys: 0 inside or outside, 1 to 4 the corners, 5 to - `pub const fn from_index(index: u64) -> Option`. The part keyed by `index`: the inverse of [`index`](Self::index), with 0 the inside. -- `craft_behavior::geometry::quad::BoxRules`: `pub struct BoxRules { pub mode: TransformMode, pub scale: ScaleRule, pub aspect_linked: bool, pub allow: BoxAllow, pub rotate_step: f64, pub min_side: f64 }`. How drags change a box. +- `craft_behavior::geometry::quad::BoxRules`: `pub struct BoxRules { pub mode: TransformMode, pub scale: ScaleRule, pub aspect_linked: bool, pub allow: BoxAllow, pub rotate_step: f64, pub min_side: f64, pub handles: BoxHandles, pub edge_band: f32 }`. How drags change a box. - `pub fn in_mode(mode: TransformMode) -> BoxRules`. The rules of `mode` with the default scale rule, a linked aspect, everything allowed and - `pub fn with_scale(mut self, scale: ScaleRule) -> BoxRules`. The rules with `scale` as the plain corner and edge drag rule. - `pub fn with_aspect_linked(mut self, linked: bool) -> BoxRules`. The rules with the options bar's aspect link on or off. - `pub fn with_allow(mut self, allow: BoxAllow) -> BoxRules`. The rules with `allow` as what the content permits. - `pub fn with_min_side(mut self, side: f64) -> BoxRules`. The rules with `side` as the minimum side of a scaled box, in document units. + - `pub fn with_handles(mut self, handles: BoxHandles) -> BoxRules`. The rules with `handles` as the handles the box shows. + - `pub fn with_edge_band(mut self, points: f32) -> BoxRules`. The rules with each side grabbed within `points` of its line ([`edge_band`](Self::edge_band)). + - `pub fn shows(&self, part: BoxPart) -> bool`. Whether the box shows `part`: `Corners` shows the four corners and no side, `Sides` the right and left sides - `pub fn effective_mode(&self) -> TransformMode`. The mode drags follow: a mode the content refuses scales as Free Transform does. - `pub fn allows(&self, part: BoxPart) -> bool`. Whether a drag of `part` changes the box: in Distort only the corners, the inside and the - `pub fn drag_kind(&self, part: BoxPart, mods: Mods) -> Option`. What a drag of `part` with `mods` held (as the host has them, before @@ -1005,7 +1033,7 @@ Box geometry of transform boxes: where the box goes when a part of it is dragged - `craft_behavior::geometry::quad::Parts`: `pub struct Parts { pub w: f64, pub h: f64, pub angle: f64, pub skew_h: f64, pub skew_v: f64 }`. A box read as the options bar shows it: the starting rect scaled by `w` and `h`, skewed by - `pub const fn new(w: f64, h: f64, angle: f64, skew_h: f64, skew_v: f64) -> Self`. The readings: scale factors `w` and `h`, the `angle` in degrees and the two skews in degrees. - `craft_behavior::geometry::quad::SKEW_LIMIT`: `pub const SKEW_LIMIT: f64`. The skew fields' reach in degrees: a skew of ±90° would flatten the box (PhotoCraft's). -- `craft_behavior::geometry::quad::ScaleRule`: `pub enum ScaleRule { Proportional, Free, Shape, Corners }`. What a plain corner or edge drag does. +- `craft_behavior::geometry::quad::ScaleRule`: `pub enum ScaleRule { Proportional, Free, LargerAxis, Shape, Corners }`. What a plain corner or edge drag does. - `craft_behavior::geometry::quad::TransformMode`: `pub enum TransformMode { Free, Rotate, Skew, Distort, Perspective }`. Edit › Transform's modes. - `craft_behavior::geometry::quad::bisector`: `pub fn bisector(screen: &BoxState, i: usize) -> emath::Vec2`. Corner `i` of `screen`'s unit bisector, pointing into the box; zero for a collapsed corner. The - `craft_behavior::geometry::quad::drag`: `pub fn drag(start: &BoxState, last: &BoxState, part: BoxPart, from: Point, to: Point, mods: Mods, rules: &BoxRules) -> BoxState`. The box after dragging `part` from `from` to `to` (document points) with `mods` held, from the @@ -1070,7 +1098,7 @@ The `Grid` cursor: columns resolved from last pass's measurements, and the cell - `craft_behavior::grid::GridCursor`: `pub struct GridCursor`. Hands out the cells of one `Grid` pass, row-major. Cells are placed from `last` pass's measurements; this - `pub fn new(flow: Flow, columns: &[ColumnWidth], gap: Vec2, last: &GridMeasure) -> Self`. A cursor over `columns` in `flow`'s rect, with `gap` between columns (x) and rows (y), placed by `last`. A - `pub fn sized_by_content(flow: Flow, columns: &[ColumnWidth], gap: Vec2, last: &GridMeasure) -> Self`. A cursor for a measuring run under a body sized from its content: each `Fill` column of `columns` is placed - - `pub fn unbounded(flow: Flow, columns: &[ColumnWidth], gap: Vec2) -> Self`. A cursor for the sweep that asks each column for its least: every column but a `Fixed` one is placed as a + - `pub fn unbounded(flow: Flow, columns: &[ColumnWidth], gap: Vec2) -> Self`. A cursor for the sweep that asks each column for its least: the cells of every `Content` and `Fill` column - `pub fn each_alone(mut self) -> Self`. The cursor with each `Content` column measuring in the room the other columns leave at their least, whatever - `pub fn short(&self) -> bool`. Whether the columns, as this sweep measured them, do not fit beside each other: the columns that do not share - `pub fn cell(&mut self, size: Vec2) -> Rect`. The cell of the next child, whose measured size is `size`. @@ -1107,15 +1135,16 @@ Hit shapes, their priority and the arena's resolve rule (8.3). - `pub fn hit(&self, point: Pos2) -> bool`. Whether `point` hits the shape. - `craft_behavior::hit::LINE_REACH`: `pub const LINE_REACH: f32`. How far from a line a point still hits it, in points. - `craft_behavior::hit::ResolveFor`: `pub enum ResolveFor { Press, Hover }`. What a resolution is for. -- `craft_behavior::hit::Shape`: `pub struct Shape { pub shape: HitShape, pub sense: Sense, pub owner: O, pub part: Option, pub priority: HitPriority, pub position: u32, pub local: bool, pub min_across: f32 }`. One registered shape of the shape record: a root's, a member's or a part's. +- `craft_behavior::hit::Shape`: `pub struct Shape { pub shape: HitShape, pub sense: Sense, pub owner: O, pub part: Option, pub priority: HitPriority, pub position: u32, pub local: bool, pub min_across: f32, pub stacking: u32, pub drag_to_root: bool }`. One registered shape of the shape record: a root's, a member's or a part's. - `pub fn translated(&self, by: Vec2) -> Self`. The shape moved by `by`. - `pub fn snapped(&self, to: &Shape, within: f32) -> Self`. The shape with its geometry and least size across taken from `to`'s where they lie within `within` points - `pub const fn new(shape: HitShape, sense: Sense, owner: O, part: Option, priority: HitPriority, position: u32) -> Self`. A shape of `owner` at stack `position`. - `pub const fn min_across(mut self, across: f32) -> Self`. The hit area is at least `across` points wide and high. + - `pub const fn stacking(mut self, order: u32) -> Self`. The shape's stacking order among shapes of its priority: the higher order wins before the nearest centre. - `pub const fn local(mut self, local: bool) -> Self`. The shape lies in the body layer's space. - `pub fn hits(&self, point: Pos2) -> bool`. Whether `point` lies in the hit area: the shape grown to be at least its `min_across` wide and high. The -- `craft_behavior::hit::Winner`: `pub struct Winner { pub index: usize, pub owner: O, pub part: Option, pub sense: Sense, pub local: bool }`. The shape that won a resolution. -- `craft_behavior::hit::resolve`: `pub fn resolve(shapes: &[Shape], point: Pos2, what: ResolveFor) -> Option>`. The winner among `shapes` at `point`: stack position first, then level, sub-level, the nearest centre, the last +- `craft_behavior::hit::Winner`: `pub struct Winner { pub index: usize, pub owner: O, pub part: Option, pub sense: Sense, pub local: bool, pub drag_to_root: bool }`. The shape that won a resolution. +- `craft_behavior::hit::resolve`: `pub fn resolve(shapes: &[Shape], point: Pos2, what: ResolveFor) -> Option>`. The winner among `shapes` at `point`: stack position first, then level, sub-level, stacking order, the nearest - `craft_behavior::hit::resolve_mapped`: `pub fn resolve_mapped(shapes: &[Shape], point: Pos2, what: ResolveFor, to_local: impl Fn(Pos2) -> Pos2) -> Option>`. [`resolve`] where shapes with `local` set are tested at `to_local(point)`. ## `craft_behavior::hold_repeat` @@ -1168,6 +1197,7 @@ Item geometry: where each item of a collection sits for a scroll offset and view - `fn visible(&self, offset: ScrollPos, view: Vec2, out: &mut Vec)`. The indices of the items that intersect a viewport of size `view` scrolled to `offset`, ascending. - `fn rect(&self, at: usize, offset: ScrollPos) -> Rect`. The rect of item `at`. - `fn hit(&self, point: Pos2, offset: ScrollPos) -> Option`. The item under `point`. + - `fn drop_hit(&self, point: Pos2, offset: ScrollPos) -> Option`. The item whose drop area contains `point`. Layouts with visible gaps can include those in a drop area while - `fn nav(&self) -> NavShape`. How arrow keys move through the items. - `fn row_len(&self, _row: usize) -> Option`. `NavShape::RaggedGrid`: the number of items in `row`, rows holding consecutive items and a run of hidden items - `fn column_shift(&self, _from: usize, _to: usize) -> isize`. `NavShape::RaggedGrid`: the columns a vertical move from row `from` to row `to` shifts the column by, when the rows @@ -1242,6 +1272,7 @@ Where a collection's items come from: the data traits and the one way to show a - `fn open(&self, _at: usize) -> bool`. Whether the children of entry `at` show. - `fn is_section(&self, _at: usize) -> bool`. Whether entry `at` is a section header, which navigation skips. - `fn section_stop(&self, _at: usize) -> bool`. Whether section `at` is a stop of navigation: it holds the lead, takes Enter, the context-menu key and a + - `fn selectable_section(&self, _at: usize) -> bool`. Whether a section stop also represents an item that keyboard selection can pick or extend over. - `fn section_stops_before(&self, _at: usize) -> usize`. How many section stops (`section_stop`) come before entry `at`. They are not members of the set of items, so - `fn enabled(&self, _at: usize) -> bool`. Whether entry `at` can take the lead. - `fn text(&self, _at: usize) -> Option>`. The text type-ahead matches entry `at` against. @@ -1265,13 +1296,16 @@ Where a collection's items come from: the data traits and the one way to show a The key table (spec 9.2): the one place that maps a key press to an intent and modifiers to `MoveMods`. +- `craft_behavior::keys::ALT_ARROW_KEYS`: `pub const ALT_ARROW_KEYS: [Chord; 4]`. The four Alt+arrow chords of `ReorderKeys::AltArrows`. +- `craft_behavior::keys::CopyKeys`: `pub enum CopyKeys { Alt, Platform }`. Which held key turns a drag into a copy over a target. - `craft_behavior::keys::DropOperation`: `pub enum DropOperation { Move, Copy, Link }`. What a drop of a dragged payload does with it. -- `craft_behavior::keys::KeyRole`: `pub struct KeyRole { pub resettable: bool, pub space: bool, pub multi_select: bool, pub reorderable: bool, pub rename: bool, pub pages: bool, pub nudge: bool, pub document: bool, pub type_ahead: bool, pub digits: bool, pub value: bool, pub text: bool, pub moves: bool, pub deletes: bool, pub stacked: bool, pub owner_arrows: bool, pub home_row: usize }`. What the focused stop is, as far as the table's rows differ. +- `craft_behavior::keys::KeyRole`: `pub struct KeyRole { pub resettable: bool, pub space: bool, pub multi_select: bool, pub reorderable: Option, pub reorder_axis: Axis, pub rename: bool, pub pages: bool, pub nudge: bool, pub document: bool, pub type_ahead: bool, pub digits: bool, pub value: bool, pub text: bool, pub moves: bool, pub deletes: bool, pub stacked: bool, pub owner_arrows: bool, pub home_row: usize }`. What the focused stop is, as far as the table's rows differ. - `pub const fn new() -> KeyRole`. A role with no special rows. - `pub const fn resettable(mut self, on: bool) -> Self`. Delete resets the control. - `pub const fn space(mut self, on: bool) -> Self`. Space is the component's own intent. - `pub const fn multi_select(mut self, on: bool) -> Self`. Ctrl+Space toggles the lead's pick. - - `pub const fn reorderable(mut self, on: bool) -> Self`. The stacking keys move the selected items. + - `pub const fn reorderable(mut self, keys: Option) -> Self`. The scheme's keys move the selected items; `None` when the stop does not reorder. + - `pub const fn reorder_axis(mut self, axis: Axis) -> Self`. The axis the order is laid out along. - `pub const fn rename(mut self, on: bool) -> Self`. Rename has its key. - `pub const fn pages(mut self, on: bool) -> Self`. Ctrl+Tab switches pages. - `pub const fn nudge(mut self, on: bool) -> Self`. Arrows are nudges, not moves. @@ -1286,9 +1320,10 @@ The key table (spec 9.2): the one place that maps a key press to an intent and m - `pub const fn home_row(mut self, row: usize) -> Self`. Ctrl or Cmd with Home goes to item `row`. - `pub const fn text(mut self, on: bool) -> Self`. The stop is a text part. - `craft_behavior::keys::REORDER_KEYS`: `pub const REORDER_KEYS: [Chord; 6]`. The stacking keys (Photoshop's Bring Forward and Send Backward): Cmd+] moves the selected items one place toward the -- `craft_behavior::keys::drop_operation`: `pub fn drop_operation(os: Os, mods: Mods) -> DropOperation`. The drop operation the held modifiers pick. +- `craft_behavior::keys::ReorderKeys`: `pub enum ReorderKeys { Stacking, AltArrows }`. The named key scheme of a reorderable collection. +- `craft_behavior::keys::drop_operation`: `pub fn drop_operation(os: Os, mods: Mods, copy: CopyKeys) -> DropOperation`. The drop operation the held modifiers pick over a target that copies with `copy`. Link is Ctrl+Shift, Cmd+Option on - `craft_behavior::keys::intent`: `pub fn intent(os: Os, key: Key, mods: Mods, role: KeyRole) -> Option`. The intent a key press has for a stop of `role`, if any. `Enter` and `Space` as activation are not rows: -- `craft_behavior::keys::reorder_intent`: `pub fn reorder_intent(key: Key, mods: Mods) -> Option`. The `Intent::MoveItem` a stacking key asks for, `None` for any other press. +- `craft_behavior::keys::reorder_intent`: `pub fn reorder_intent(key: Key, mods: Mods, keys: ReorderKeys, axis: Axis) -> Option`. The `Intent::MoveItem` a key of the scheme `keys` asks for in an order laid out along `axis`, `None` for any other - `craft_behavior::keys::split_digits`: `pub fn split_digits(text: &str) -> (Vec, String)`. Typed `text` split for a role that takes digits: the ASCII digits it holds, in order, and the text without them. - `craft_behavior::keys::toward_end`: `pub fn toward_end(front: bool, axis: Axis) -> bool`. Whether a move toward the front goes toward the end of an order laid out along `axis`. The front of a vertical @@ -1312,6 +1347,20 @@ The tolerance rule of layout memory: when a measured size asks for a discard pas - `craft_behavior::layout_memory::measure_tolerance`: `pub fn measure_tolerance(pixels_per_point: f32) -> f32`. The tolerance in points under which a measured size equals the one placement used: half a physical pixel. - `craft_behavior::layout_memory::measured_change_asks_for_discard`: `pub fn measured_change_asks_for_discard(recorded: Option, real: Vec2, changed_last_frame: bool, tolerance: f32) -> bool`. Whether a measured size asks for a discard pass. `recorded` is the size placement used this frame +## `craft_behavior::middle_scroll` + +The middle button's auto-scroll latch: the gesture state of one middle press. + +- `craft_behavior::middle_scroll::MiddleButton`: `pub enum MiddleButton { Pan, AutoScroll }`. What the middle button does over a scroll area. +- `craft_behavior::middle_scroll::MiddleScroll`: `pub struct MiddleScroll`. The auto-scroll latch of one middle press. + - `pub fn press(&mut self, at: Pos2, inside: bool)`. A middle press: inside the scroll area it latches at `at`; a second press ends the latch. + - `pub fn release(&mut self)`. The button went up: after two held passes with the pointer past the dead zone the latch ends; an earlier + - `pub fn swallows(&mut self, phase: PressPhase) -> bool`. Whether a press's `phase` belongs to the press that ended a latch and so reaches nothing else: true for the + - `pub fn cancel(&mut self)`. Ends the latch. + - `pub fn step(&mut self, pointer: Pos2, held: bool, dt: f64, invert: bool) -> Vec2`. One pass: with this pass's `pointer` and `held` state it counts the held passes past the 15 pt dead zone and + - `pub fn anchor(&self) -> Option`. Where the latch is anchored, `None` when there is none. + - `pub fn active(&self) -> bool`. Whether a latch is active. + ## `craft_behavior::monitor` The connected monitors, as every window placement reads them. @@ -1491,6 +1540,7 @@ Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime conver - `craft_behavior::press::PointerSample`: `pub struct PointerSample { pub pressure: f32, pub tilt: [f32; 2], pub rotation: f32, pub eraser: bool, pub wheel: Option }`. Pressure and tilt of the current contact. - `pub const fn new(pressure: f32) -> Self`. A sample with no tilt or rotation. - `pub fn sanitized(self) -> Self`. The sample with every field in range: pressure within 0 to 1, tilt and rotation finite radians, a stray value +- `craft_behavior::press::PressAside`: `pub struct PressAside { pub target: T, pub start: PressStart, pub pos: Pos2 }`. A secondary press made and released while a primary press was open ([`PressStep::aside`]). Its target is the one - `craft_behavior::press::PressCancel`: `pub enum PressCancel { Escape, FocusLost, Disabled, Removed, Host, Gesture }`. Why a captured press ended without a release. - `craft_behavior::press::PressMachine`: `pub struct PressMachine`. The press lifecycle of one root: the press winner it picked, kept until release or cancel. - `pub const fn new() -> Self`. A machine with no press. @@ -1500,7 +1550,8 @@ Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime conver - `pub fn start(&self) -> Option`. The press the open press began as. - `pub fn take_over(&mut self, target: T, sense: Sense, start: PressStart)`. Takes over a press whose button is down and went down elsewhere, as a drag of `target` from `start`: the next - `pub fn release_held(&self) -> bool`. Whether the button went up and the release waits for a later pass, which the caller must ask for: no input may - - `pub fn step(&mut self, input: PassInput<'_>, mut pick: impl FnMut(Pos2) -> Option<(T, Sense)>) -> PressStep`. Runs one pass. `pick` chooses the press winner and what it senses at a press position; it returns `None` + - `pub fn step(&mut self, input: PassInput<'_>, mut pick: impl FnMut(Pos2, PointerButton) -> Option>) -> PressStep`. Runs one pass. `pick` chooses the press winner and what it senses at a press position, for the button pressed + - `pub fn hand_over(&mut self, target: T, sense: Sense) -> Option>`. Makes `target` the open press's target in the pass that reported `passes`, dragging from the same - `craft_behavior::press::PressPhase`: `pub enum PressPhase { Idle, Hover, Down { start: PressStart }, Held { start: PressStart, pos: Pos2 }, DragStart { start: PressStart, pos: Pos2 }, Drag { start: PressStart, pos: Pos2, delta: Vec2 }, Release { start: PressStart, pos: Pos2, click: bool }, Cancel { start: PressStart, reason: PressCancel } }`. One part's press state in one pass. - `pub const fn is_press(&self) -> bool`. A press is in progress or just ended: not `Idle` or `Hover`. - `pub const fn start(&self) -> Option`. The press the phase belongs to. @@ -1508,16 +1559,20 @@ Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime conver - `pub const fn is_drag(&self) -> bool`. Whether the phase is a drag in progress. - `pub const fn is_click(&self) -> bool`. Whether the phase is a click: a release within slop. - `pub fn mapped(self, point: impl Fn(Pos2) -> Pos2, delta: impl Fn(Vec2) -> Vec2) -> PressPhase`. The phase with its positions mapped by `point` and its drag delta by `delta`, for a part whose space -- `craft_behavior::press::PressStart`: `pub struct PressStart { pub origin: Pos2, pub button: PointerButton, pub time: f64, pub clicks: u32 }`. Where and when a press began. +- `craft_behavior::press::PressPick`: `pub struct PressPick { pub target: T, pub sense: Sense, pub passed: bool }`. The press winner a root picks at a press position, as [`PressMachine::step`]'s `pick` returns it. + - `pub fn new(target: T, sense: Sense) -> Self`. `target`, sensing `sense`, takes the press. + - `pub fn passed(mut self) -> Self`. The press's click went to a shape above that passes its drag to this target. +- `craft_behavior::press::PressStart`: `pub struct PressStart { pub origin: Pos2, pub button: PointerButton, pub time: f64, pub clicks: u32, pub handed: bool }`. Where and when a press began. - `pub const fn new(origin: Pos2, button: PointerButton, time: f64, clicks: u32) -> Self`. A press of `button` at `origin`. -- `craft_behavior::press::PressState`: `pub struct PressState { pub phase: PressPhase, pub mods: Mods, pub sample: Option, pub captured: bool }`. A part's phase, the modifiers held, the pen sample and whether it holds the pointer. +- `craft_behavior::press::PressState`: `pub struct PressState { pub phase: PressPhase, pub mods: Mods, pub sample: Option, pub captured: bool, pub context: Option }`. A part's phase, the modifiers held, the pen sample and whether it holds the pointer. - `pub const IDLE: PressState`. A part with no press history. - - `pub const fn new(phase: PressPhase) -> Self`. A state in `phase` with no modifiers, sample or capture. + - `pub const fn new(phase: PressPhase) -> Self`. A state in `phase` with no modifiers, sample, capture or aside context request. + - `pub const fn context(mut self, at: Option) -> Self`. The aside secondary press that came up on the part at `at` in this pass. - `pub const fn mods(mut self, mods: Mods) -> Self`. The modifiers held. - `pub const fn sample(mut self, sample: Option) -> Self`. The pen sample of the contact. - `pub const fn captured(mut self, captured: bool) -> Self`. Whether a drag holds the pointer. - `pub const fn double_pressed(&self) -> bool`. Whether the phase is the `Down` of the second press of a double click: true once, false while the button is -- `craft_behavior::press::PressStep`: `pub struct PressStep { pub target: Option, pub phase: Option, pub dragging: bool, pub activated: Option }`. What one pass did to the press. +- `craft_behavior::press::PressStep`: `pub struct PressStep { pub target: Option, pub phase: Option, pub dragging: bool, pub activated: Option, pub passes: Option, pub aside: Option> }`. What one pass did to the press. - `craft_behavior::press::count_clicks`: `pub fn count_clicks(previous: Option<(Pos2, f64, u32, Mods)>, pos: Pos2, time: f64, mods: Mods, slop: f32) -> u32`. The click count of a press at `pos` and `time` with `mods` held, given the previous press `(pos, time, clicks, ## `craft_behavior::quantity` @@ -1535,6 +1590,7 @@ Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime conver - `pub fn decimal_separator(&self) -> char`. The decimal separator the reader reads and writes. - `pub fn read(&self, text: &str, start: Option) -> Result`. The value of `text`. `start` is the value relative input applies to. - `pub fn read_tagged(&self, text: &str, start: Option) -> Result<(f64, Option), NotAValue>`. The value of `text` and the tag of the unit its last quantity named (`None` for a bare number or an untagged + - `pub fn share(&self, text: &str) -> Option`. The fraction a lone percentage writes (`50%` is 0.5): a number and `%`, with no sign, unit or operator; - `craft_behavior::quantity::is_unit_spelling`: `pub fn is_unit_spelling(spelling: &str) -> bool`. Whether `spelling` can be registered with [`Reader::unit`]: letters and unit symbols only, so the reader can ## `craft_behavior::role_rule` @@ -1776,7 +1832,7 @@ The value core of chapter 10: the bound every value type meets, `Mixed`, edit ev Wheel gesture values, as craft-behavior's copy of egui's types so the wheel split is egui-free. - `craft_behavior::wheel::GESTURE_GAP`: `pub const GESTURE_GAP: f64`. The seconds between wheel events that still belong to one gesture. -- `craft_behavior::wheel::Wheel`: `pub struct Wheel { pub scroll: Vec2, pub lines: Vec2, pub zoom: f32, pub mods: Mods, pub unit: WheelUnit, pub phase: WheelPhase, pub source: WheelSource, pub at: Option, pub zooms: bool, pub touch_zoom: f32, pub rotation: f32, pub touch_rotation: f32, pub touch_pan: Vec2 }`. One wheel event, or the sum of one pass's, as a taker reads it with `take_wheel`. +- `craft_behavior::wheel::Wheel`: `pub struct Wheel { pub scroll: Vec2, pub lines: Vec2, pub zoom: f32, pub mods: Mods, pub unit: WheelUnit, pub phase: WheelPhase, pub source: WheelSource, pub at: Option, pub zooms: bool, pub touch_zoom: f32, pub rotation: f32, pub touch_rotation: f32, pub touch_pan: Vec2, pub gathered: Vec2, pub moved: bool }`. One wheel event, or the sum of one pass's, as a taker reads it with `take_wheel`. - `pub const fn new(scroll: Vec2, mods: Mods, unit: WheelUnit, phase: WheelPhase) -> Self`. A scroll of `scroll` points with no zoom. - `pub const fn zoom(mut self, zoom: f32) -> Self`. The same gesture with zoom factor `zoom`. - `pub const fn touch_zoom(mut self, zoom: f32) -> Self`. The same gesture with the two-finger touch zoom factor `zoom`. @@ -1785,6 +1841,11 @@ Wheel gesture values, as craft-behavior's copy of egui's types so the wheel spli - `pub const fn touch_pan(mut self, pan: Vec2) -> Self`. The same gesture with the two-finger touch movement `pan`, in points. - `pub const fn source(mut self, source: WheelSource) -> Self`. The same gesture from `source`. - `pub const fn at(mut self, at: Pos2) -> Self`. The same gesture with the pointer at `at`. +- `craft_behavior::wheel::WheelEase`: `pub struct WheelEase`. The eased motion of a canvas's line wheel: notches gather into owed motion that later passes pay out. + - `pub fn feed(&mut self, pan: Vec2, now: f64)`. Adds the line pan `pan` of this pass, at time `now`, to the owed motion; a burst of notches under 0.08 s apart + - `pub fn cancel_axis(&mut self, x: bool, y: bool)`. Drops the owed motion on the axes marked. + - `pub fn step(&mut self, now: f64) -> Vec2`. The step this pass pays at time `now`: `1 − 0.1^(dt/0.1)` of the owed motion, with `dt` since the last paid pass. + - `pub fn owes(&self) -> bool`. Whether motion is still owed. - `craft_behavior::wheel::WheelFocus`: `pub struct WheelFocus { pub taker: Option, pub app_field: bool, pub by_position: bool }`. Who holds key focus, as the split reads it. - `pub const fn new(taker: Option) -> Self`. Focus on `taker`, or on nothing that takes the wheel. - `pub const fn app_field(mut self, on: bool) -> Self`. The same focus, in a text field the app drew itself when `on`. @@ -1850,7 +1911,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `fn measures_items(&self) -> bool`. Whether the layout sizes its items from their own measure: the items step measures every item at its ideal - `fn dress_inputs(&self) -> u64`. What `dress` reads of the collection, hashed: a kept measure of the items serves only while it is the same. - `fn ideal_width(&self, _item: Option, _rows: usize, _cx: &StyleCx<'_>) -> f32`. The width the collection asks for when it takes its width from its content, over its widest row: a grid of - - `fn filtered<'s>(&self, _source: &'s dyn ItemSource, _env: &crate::runtime::env::Env) -> Option + 's>>`. A view of `source` for this pass, such as the rows a filter keeps; `None` shows `source` as it is. + - `fn filtered<'s>(&self, _source: &'s dyn ItemSource, _env: &crate::runtime::env::Env, _kept: Option<&Self::Key>,) -> Option + 's>>`. A view of `source` for this pass, such as the rows a filter keeps; `None` shows `source` as it is. `kept` is the - `fn dress<'r>(&self, item: Self::Item<'r>, _row: &RowState) -> Self::Item<'r>`. Adjusts the item the closure built for a row, from the row's state. An auto row's measure reads the item this - `fn rename_editor(&mut self, _ui: &mut Ui, _draft: Bind<'_, String>, _label: Rect, _name: &str) -> Option>`. The rename editor at `label`: the label rect the renaming item reports (`ItemOutput::label_rect`), else its row. - `fn hosts_header(&self, _column: &ColumnKey) -> bool`. Whether the collection hosts a component in the header cell of `column`: the header then calls `header_cell` @@ -1861,7 +1922,8 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `fn accepts(&self, _drag: &ListDrag, _over: Option<&Self::Key>, _insert: usize) -> bool`. Whether the collection's own dragged items may land before `insert` (a position of the display order, `over` is - `fn drops(&self) -> &[DropKind<'_, Self::Key>]`. What the collection takes from drags that did not start in it, in order: the first kind that takes the drag's - `fn edge_press(&self) -> Option<&EdgePress<'_, Self::Key>>`. The press on the line between two adjacent rows the collection takes, reported as - - `fn zooms(&self) -> bool`. Whether the collection takes the zoom share of the wheel (Ctrl or Cmd with the wheel): it reports + - `fn zooms(&self) -> bool`. Whether the collection takes the zoom share of the wheel (Ctrl or Cmd with the wheel): the items step reports + - `fn zoom_anchor(&self, _wheel: Option) -> Option`. The point whose row stays in place across a zoom step this collection takes in the current pass, in screen - `fn empty_height(&self, width: f32, ui: &Ui, cx: &StyleCx<'_>) -> f32`. The height of the empty state at `width`: a `Sizing::Content` collection with no rows is this tall. The - `fn empty(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>)`. The empty state at the rect the item step placed. The default shows `CollectionProps::empty`. - `craft_ui::contract::Component`: `pub trait Component: Meta + Sized`. The core trait: every UI type is a `Component`. @@ -1873,6 +1935,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `const PARTS: bool`. Whether the component declares parts, a text part or an editor part: `false` skips the parts step (the parts - `const STOPS: bool`. Whether the component or its parts can take key focus: `false` skips the stop registration of step 7, except - `const FOCUS_SCOPE: crate::runtime::focus::FocusPolicy`. The focus scope a leaf runs in, as `ContainerProps::focus` gives a container's: the leaf's own stop and its + - `fn focus_scope(&self) -> crate::runtime::focus::FocusPolicy`. The focus scope this instance runs in. The default is `FOCUS_SCOPE`; a component whose scope is a choice of its - `const KEYS: crate::runtime::focus::KeyUse`. Keys the focused component keeps from egui and the shortcut dispatcher. - `fn keys(&self) -> crate::runtime::focus::KeyUse`. The keys this instance keeps in its current state. The default is `KEYS`; a component whose key use depends - `const SHOWS_LABEL: bool`. Whether the component paints its label as visible text. `false` for a face that shows only an icon or a @@ -1886,6 +1949,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `fn shows_label(&self) -> bool`. Whether this instance paints its label as visible text; `SHOWS_LABEL` unless an instance prop decides, as - `fn label_detail(&self) -> Option`. The muted line a `LABELLED_AFTER` control's label shows after its text (`SideLabel::detail`), as a radio's - `fn paint_outset(_tokens: &crate::style::UiTokens) -> f32`. How far the component paints outside its rect by design, in points (a graph node's ports sit on its edge). + - `fn default_variant(_env: &crate::runtime::env::Env) -> Option`. The variant an instance that asks for none takes in `env`; `None` takes the style's first. A variant the caller - `fn style(cx: &StyleCx<'_>, key: Self::StyleKey) -> Self::Style`. Pure function of the resolved context and the key. - `fn padding(&self, _rect: Rect, style: &Self::Style) -> craft_behavior::Insets`. The insets from `rect` to the content rect where the component is shown: the style's padding. A component - `fn measure(&mut self, _cx: &MeasureCx<'_, Self>) -> Vec2`. Content size only; the pipeline adds padding and minimum size. @@ -1992,6 +2056,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `pub fn take_pick_answer(&self, ticket: craft_host::PickId) -> Option`. The host file service's answer to the picker `ticket`, taken once. A measuring run gets none and leaves - `pub fn is_exiting(&self) -> bool`. Whether the container has closed and its body only stays on screen while it fades out. `is_open` reads true - `pub fn field_message(&self) -> Option<(Message, craft_theme::variant::Tone)>`. The validity message of the first control in the container's label scope, recorded last frame, with the + - `pub fn moving(&self) -> bool`. Whether a drag of the container's move band (`DragBand::Move`) moves its layer in this pass, from the pass the - `pub fn is_open(&self) -> bool`. Whether the body is open. - `pub fn open(&mut self) -> &mut bool`. The open state: a title row's disclosure binds to it, and step 15 writes a change to its owner. - `pub fn gate(&mut self) -> Option<&mut bool>`. The gate's shown copy, for a container whose value is a bool: a title row's check box binds to it, and @@ -2014,20 +2079,26 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `pub fn align(self, align: RowAlign) -> Self`. A `Row` with `align`; any other layout is unchanged. - `craft_ui::contract::Bracket`: `pub enum Bracket { Linked, Unlinked }`. The bracket a `Row` draws from the labelled rows of its first child to the child after them (Image Size's width and - `craft_ui::contract::CanvasGesture`: re-export of `craft_ui::runtime::sampler::CanvasGesture`. +- `craft_ui::contract::CaptionColumn`: `pub struct CaptionColumn`. Whether the beside captions of a [`LabelScheme::Inline`] form share one column. Off (the default), each caption is + - `pub const SHARED: CaptionColumn`. The captions share one column. + - `pub const OWN: CaptionColumn`. Each caption is as wide as its own text (the default). + - `pub const fn shared(self) -> bool`. Whether the captions share one column. +- `craft_ui::contract::CaptionInk`: `pub enum CaptionInk { Muted, Normal }`. The ink of a side label's name, other than a link's ([`LinkLabelInk`]) and the text after a check box or a radio, - `craft_ui::contract::CellWidth`: `pub type CellWidth = ColumnWidth`. The width of a caption's cell. - `craft_ui::contract::Collapse`: `pub struct Collapse { pub initially_open: bool, pub animated: bool }`. Collapse configuration. - `pub const fn new() -> Self`. A collapsible body that starts open, animated. - `pub const fn initially_open(mut self, on: bool) -> Self`. Whether the body starts open. - `pub const fn animated(mut self, on: bool) -> Self`. Whether opening and closing animate. -- `craft_ui::contract::CollectionEvent`: `pub enum CollectionEvent { Selection { change: SelectionChange, by: LeadSource, mods: craft_keymap::Mods }, Picked { key: K, mods: craft_keymap::Mods }, LeadMoved { key: K, by: LeadSource }, Activate(K), Rested(K), EmptyActivated, EmptyContextMenu { at: Pos2 }, Preview(K), ContextMenu(ContextMenuRequest), EdgePressed { above: K, below: K, mods: craft_keymap::Mods }, CommandClick { key: K, mods: craft_keymap::Mods }, Delete(Vec), Open(OpenChange), Reorder(EditEvent>), Move(EditEvent), Dropped { at: DropAt, op: DropOperation, payload: DropPayload }, Zoom { factor: f32, about: Pos2 }, Rename(EditEvent>), Toggle(EditEvent>), Column(ColumnEvent), Item(K, E) }`. What a collection reports, in drawing order. -- `craft_ui::contract::CollectionProps`: `pub struct CollectionProps { pub select: SelectMode, pub reorder: Option, pub rename: bool, pub rename_column: Option, pub slow_click_rename: bool, pub columns: Vec, pub sort: Option, pub empty: Option

+ Send + Sync + 'static) -> Self`. A row drag carries `map` of it, for the drop targets of type `P`; a row the map gives `None` for does not drag - `pub fn carry(mut self, payload: DragPayload) -> Self`. A row drag carries `payload` of it too, beside the payloads given before: a host adds its own payload type to a - - `pub const fn drag_count(mut self, count: Counted) -> Self`. The drag badge reads `count` for the number of dragged items. + - `pub const fn drag_preview(mut self, preview: RowPreview) -> Self`. What a row drag shows while it runs (a badge by the pointer by default). + - `pub const fn drag_count(mut self, count: Counted) -> Self`. A row drag's preview reads `count` for the number of dragged items. - `pub const fn pages(mut self, on: bool) -> Self`. The items are pages (`CollectionProps::pages`). - `pub fn rename(mut self, on: bool) -> Self`. Rename runs through the collection's editor. - `pub fn rename_column(mut self, column: ColumnKey) -> Self`. A double click on `column` of a renamable item (`rename`, `Collection::can_rename`) opens its rename editor; the @@ -2051,17 +2122,22 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `pub const fn item_keys(mut self, keys: ItemKeys) -> Self`. Who takes the arrow keys while the collection has the key focus. - `pub const fn marquee(mut self, on: bool) -> Self`. A drag from empty space selects with a marquee. - `pub const fn deletable(mut self, on: bool) -> Self`. Delete and Backspace at the lead report the items to delete (`CollectionEvent::Delete`). + - `pub const fn delete_target(mut self, target: DeleteTarget) -> Self`. Sets where a deletable collection takes Delete and Backspace. - `pub const fn natural_height(mut self, on: bool) -> Self`. The collection takes its full content height and owns no scroll (see [`CollectionProps::natural_height`]). - `pub const fn min_rows(mut self, rows: u16) -> Self`. The collection is at least `rows` rows tall (see [`CollectionProps::min_rows`]). - `pub const fn max_rows(mut self, rows: u16) -> Self`. The collection shows at most `rows` rows and scrolls the rest (see [`CollectionProps::max_rows`]). - `pub const fn row_height(mut self, height: RowHeight) -> Self`. The rows are `height` tall (see [`RowHeight`]). - `pub const fn command_click(mut self, on: bool) -> Self`. A Cmd/Ctrl click on an item is a command, not a pick (see [`CollectionProps::command_click`]). - `pub const fn notch(mut self, notch: Notch) -> Self`. The distance one wheel notch scrolls the rows (see [`CollectionProps::notch`]). + - `pub const fn middle_button(mut self, button: MiddleButton) -> Self`. What a middle press does: pan, or latched auto-scroll (see [`CollectionProps::middle_button`]). + - `pub const fn primary_picks(mut self, on: bool) -> Self`. Whether only a primary press picks an item (see [`CollectionProps::primary_picks`]). + - `pub const fn invert_middle(mut self, on: bool) -> Self`. Flips the direction of middle-button pan and auto-scroll (see [`CollectionProps::invert_middle`]). - `pub fn wheel_notch(&self, line: f32) -> craft_behavior::WheelNotch`. The wheel distance of one notch, with a text line `line` points high: the set notch, else the default. - `pub const fn overflow(mut self, axis: Axis) -> Self`. The axis the rows overflow along (see [`CollectionProps::overflow`]). - `pub fn current(mut self, key: Option) -> Self`. The current item: `Some(key)` marks the item with that key, `None` marks none. `K` is the collection's key type; + - `pub const fn picks_beside_current(mut self, on: bool) -> Self`. Keeps the selection a pick beside the current item (see [`CollectionProps::picks_beside_current`]). - `pub fn empty(mut self, text: impl Into

+ Send + Sync + 'static) -> Self`. The payload `map` makes of a drag of the collection whose keys are `K`; `None` for a row that carries none. @@ -2186,7 +2266,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `fn begin(&mut self)`. Opens a gesture. - `fn commit(&mut self)`. Commits the proposed value. - `fn cancel(&mut self, reason: CancelReason)`. Cancels the running gesture. -- `craft_ui::contract::EditResponse`: `pub struct EditResponse { pub response: Response, pub events: EditEvents, pub submitted: bool, pub submit_mods: craft_keymap::Mods, pub activation_mods: craft_keymap::Mods, pub left_by_tab: Option, pub escaped: bool, pub unparsed: bool, pub validity: Validity, pub shown: Option>>, pub value_text: Option, pub tab: Option, pub caret: Option, pub hover: Hover }`. The output of a component that edits a value. Only `cx.edit_response()` builds it. +- `craft_ui::contract::EditResponse`: `pub struct EditResponse { pub response: Response, pub events: EditEvents, pub submitted: bool, pub submit_mods: craft_keymap::Mods, pub activation_mods: craft_keymap::Mods, pub left_by_tab: Option, pub text_lost_focus: bool, pub escaped: bool, pub unparsed: bool, pub validity: Validity, pub shown: Option>>, pub value_text: Option, pub tab: Option, pub caret: Option, pub hover: Hover }`. The output of a component that edits a value. Only `cx.edit_response()` builds it. - `pub fn lifted(response: Response, events: EditEvents, shown: Option>>) -> Self`. The response of a composite that edits one value through several child components: `events` are the edits of - `pub fn value(&self) -> Option<&T>`. The latest value the pass's events carry: a proposal, a commit or a set; `None` when nothing was edited or no - `pub fn map(self, f: impl Fn(T) -> U) -> EditResponse`. The response of a child component's edit as the response of the edit of a value built from it: the events, the @@ -2196,8 +2276,9 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `pub fn ime_application_change(&self, ctx: &egui::Context)`. Notes an application change of this editor part's committed text. - `pub fn ime_interrupt(&self, ctx: &egui::Context)`. Asks for the OS composition to be interrupted this pass, because this editor part refused an input method's - `craft_ui::contract::EditorStep`: `pub enum EditorStep { Input(EditorInput), Command(S, Fired) }`. One step of an editor's pass, in the order of the events it came from ([`Cx::editor_steps`]). -- `craft_ui::contract::EndRegion`: `pub struct EndRegion { pub full_height: bool, pub gap: Gap, pub rule: bool }`. An end region, filled by `Container::end`: content in reading order at the line's end edge, beside the body and +- `craft_ui::contract::EndRegion`: `pub struct EndRegion { pub full_height: bool, pub gap: Gap, pub rule: bool, pub fit: bool }`. An end region, filled by `Container::end`: content in reading order at the line's end edge, beside the body and - `pub const fn new() -> Self`. An end region as high as the line, `space.gap.tight` from the body, with no rule. + - `pub const fn fit(mut self, on: bool) -> Self`. Whether the region joins the body's fit. - `pub const fn rule(mut self, on: bool) -> Self`. Whether a rule separates the end region from the body. - `pub const fn full_height(mut self, on: bool) -> Self`. Whether the region takes the full height under the header. - `pub const fn gap(mut self, gap: Gap) -> Self`. Sets the gap between the body and the region. @@ -2219,6 +2300,8 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `pub fn icon_spec(&self) -> Option<&IconSpec<'static>>`. The icon before the label. - `pub fn is_enabled(&self) -> bool`. Whether the entry can be picked; false for a separator. - `pub fn is_stepped(&self) -> bool`. Whether a step over the closed control stops on the entry: an enabled, stepped item. + - `pub fn description(mut self, text: impl Into

`. What a component registers with `Pointer::window_drop_target`: a target over the whole window, which needs no +- `craft_ui::runtime::drag::WindowDropTarget`: `pub trait WindowDropTarget

`. What a component registers with `Pointer::window_drop_target`: a target over the whole window, optionally waiting - `type Drop`. What a drop on this target carries to the component's caller. + - `fn requires_pointer(&self) -> bool`. Whether this target waits for a pointer position before taking a drop. - `fn accept(&self, payload: &P, op: DropOperation) -> Option`. `None` rejects. `op` is the operation the held modifiers pick, which a target may refuse. - `fn mark(&self, drop: &Self::Drop) -> DropMark`. Where `drop` would land, a value the ghost layer paints. + - `fn under_modal(&self) -> bool`. Whether the target takes OS file drops (`OsFiles`) while a modal layer holds input, as - `craft_ui::runtime::drag::active`: `pub fn active(ctx: &Context) -> Option>`. The active drag payload of type `P`, from any viewport. For code without a `Cx`. - `craft_ui::runtime::drag::amend`: `pub fn amend(ctx: &Context, change: impl FnOnce(&mut P)) -> bool`. Changes the running session's payload of type `P` (or its further payload of that type) with `change`, in the frame - `craft_ui::runtime::drag::cancel`: `pub fn cancel(ctx: &Context, reason: CancelReason)`. Ends the session without a drop; the source's press ends with it, so nobody gets a drop. @@ -3679,6 +3828,7 @@ AccessKit node building, `register_accesskit_parent` and `set_accesskit_focus`: - `craft_ui::runtime::egui::access::NodeId`: `pub type NodeId = accesskit::NodeId`. The AccessKit id of a node, as a host test holds it. - `craft_ui::runtime::egui::access::bounds`: `pub fn bounds(ctx: &Context, id: Id) -> Option`. The rect `id`'s response had in the last finished pass, converted as the node's bounds are; `None` when absent, +- `craft_ui::runtime::egui::access::focused_node`: `pub fn focused_node(ctx: &Context) -> Option`. The node that held key focus at the end of the running viewport's last finished pass, the one reported to - `craft_ui::runtime::egui::access::prune_controls`: `pub fn prune_controls(update: &mut egui::accesskit::TreeUpdate)`. The step itself: every `controls` id of `update` that names no node of `update` is dropped. Other - `craft_ui::runtime::egui::access::AccessTree`: `pub struct AccessTree`. The AccessKit tree update of one frame. - `pub fn has(&self, id: Id) -> bool`. Whether the node of `id` exists. @@ -3730,8 +3880,10 @@ AccessKit node building, `register_accesskit_parent` and `set_accesskit_focus`: - `pub fn is_disabled_key(&self, key: NodeKey) -> bool`. Whether a node by key is reported as disabled. - `pub fn declares_key(&self, key: NodeKey, action: Declared) -> bool`. Whether a node by key declares `action`. - `pub fn children_of(&self, key: NodeKey) -> Vec`. The children of a node by key. -- `craft_ui::runtime::egui::access::Declared`: `pub enum Declared { Focus, Click, Increment, Decrement, SetValue, SetTextSelection, Expand, Collapse, Custom, ScrollUp, ScrollDown, ScrollLeft, ScrollRight }`. An action a node declares. +- `craft_ui::runtime::egui::access::Declared`: `pub enum Declared { Focus, Click, ContextMenu, Increment, Decrement, SetValue, SetTextSelection, Expand, Collapse, Custom, ScrollUp, ScrollDown, ScrollLeft, ScrollRight }`. An action a node declares. - `craft_ui::runtime::egui::access::NodeKey`: `pub struct NodeKey`. A node's number in the tree. + - `pub fn raw(self) -> u64`. The AccessKit node number. + - `pub fn from_raw(raw: u64) -> NodeKey`. The key of the node with AccessKit number `raw`. - `pub fn of(id: Id) -> NodeKey`. The key of the node of `id`. - `craft_ui::runtime::egui::access::TreeUpdate`: re-export of `accesskit::TreeUpdate` (outside these crates). - `craft_ui::runtime::egui::access::is_interactive`: `pub fn is_interactive(tree: &AccessTree, key: NodeKey) -> bool`. Whether the node declares an action a user can take: focus, click or a value change. @@ -3749,6 +3901,7 @@ AccessKit node building, `register_accesskit_parent` and `set_accesskit_focus`: Injected input: pointer moves, clicks, keys and text an automation client asks for, and the event builders +- `craft_ui::runtime::egui::injected::InjectedFiles`: `pub struct InjectedFiles { pub paths: Vec, pub dropped: bool }`. Files an injected step hovers over a window, and whether the step after it drops them. - `craft_ui::runtime::egui::injected::InjectedPointer`: `pub enum InjectedPointer { Down { button: PointerButton, at: Pos2, mods: Mods, pen: Option }, Move { at: Pos2, mods: Mods, pen: Option, rest: f64 }, Up { at: Pos2, mods: Mods } }`. One pointer step an automation client drives as a device would, with the modifiers held and, for a pen, its - `pub const fn down(button: PointerButton, at: Pos2, mods: Mods, pen: Option) -> Self`. `button` goes down at `at` with `mods` held and the pen's reading `pen`. - `pub const fn move_to(at: Pos2, mods: Mods, pen: Option) -> Self`. The pointer moves to `at` with `mods` held and the pen's reading `pen`. @@ -3849,7 +4002,7 @@ One-shot screenshot slots and the facts a screenshot is measured against. - `pub fn effective_tone(&self, warn: bool) -> Tone`. The tone the message shows in: its own, else `Warn` when it belongs to a `Validity::Warn` (`warn`), else `Bad`. - `craft_ui::runtime::env::MotionPolicy`: `pub struct MotionPolicy { pub mode: MotionMode, pub tokens: MotionTokens }`. The motion mode in effect, carried in `Env.motion`. - `pub const fn new(mode: MotionMode, tokens: MotionTokens) -> Self`. The policy that runs animations at `mode` with `tokens`. -- `craft_ui::runtime::env::Overrides`: `pub struct Overrides { pub size: Option, pub enabled: Option, pub read_only: Option, pub wheel: Option, pub motion: Option, pub direction: Option, pub words: Option, pub values: AppValues, pub id_salt: Option }`. Changes to the inherited values for a stretch of code. +- `craft_ui::runtime::env::Overrides`: `pub struct Overrides { pub size: Option, pub enabled: Option, pub read_only: Option, pub wheel: Option, pub motion: Option, pub direction: Option, pub flow: Option, pub words: Option, pub values: AppValues, pub id_salt: Option }`. Changes to the inherited values for a stretch of code. - `craft_ui::runtime::env::PageBandRoom`: `pub struct PageBandRoom { pub rect: Rect, pub start: f32, pub end: f32 }`. The room of the page band while a full-window page shows: the title-bar-high strip at the window's top and the room - `pub const fn new(rect: Rect, start: f32, end: f32) -> Self`. The band at `rect`, the window's start end taking `start` of it and its end end `end`. - `craft_ui::runtime::env::PaneEdge`: `pub enum PaneEdge { Center, Start, End, Top, Bottom }`. Where a shell pane sits. @@ -3857,7 +4010,7 @@ One-shot screenshot slots and the facts a screenshot is measured against. - `pub const fn points_per_inch(self) -> f64`. How many points make an inch. - `craft_ui::runtime::env::ResolvedRoot`: `pub struct ResolvedRoot { pub mode: Mode, pub contrast: Contrast, pub motion: MotionMode }`. The mode, contrast and motion of a pass, with `System` resolved. - `craft_ui::runtime::env::RevealEdge`: `pub enum RevealEdge { Top, Start, End }`. An edge of the window whose slots a pointer at the edge reveals in body-only mode. The bottom edge and the centre -- `craft_ui::runtime::env::RootEnv`: `pub struct RootEnv { pub sizes: Arc, pub text_size: TextSize, pub direction: Direction, pub motion: MotionChoice, pub mode: ModeChoice, pub contrast: ContrastChoice, pub density: Size, pub scale: Scale, pub tab_all_controls: bool, pub tab_toggles_chrome: bool, pub dialog_tab: TabReach, pub canvas_pattern: bool, pub cursor_follows_zoom: bool, pub tooltips: bool, pub values: AppValues, pub today: Option, pub wheel: WheelSpeed, pub alt_codes: AltCodePages }`. The app's root values each frame. +- `craft_ui::runtime::env::RootEnv`: `pub struct RootEnv { pub sizes: Arc, pub text_size: TextSize, pub direction: Direction, pub motion: MotionChoice, pub mode: ModeChoice, pub contrast: ContrastChoice, pub density: Size, pub scale: Scale, pub tab_all_controls: bool, pub tab_toggles_chrome: bool, pub escape_leaves_fields: bool, pub shortcuts_repeat: bool, pub dialog_tab: TabReach, pub canvas_pattern: bool, pub cursor_follows_zoom: bool, pub tooltips: bool, pub values: AppValues, pub today: Option, pub wheel: WheelSpeed, pub alt_codes: AltCodePages, pub ctrl_wheel_pinch: bool }`. The app's root values each frame. - `pub fn new() -> Self`. A root with every value at its default. - `pub fn scale(mut self, scale: Scale) -> Self`. Sets the interface scale. - `pub fn direction(mut self, direction: Direction) -> Self`. Sets the layout direction. @@ -3880,6 +4033,7 @@ One-shot screenshot slots and the facts a screenshot is measured against. - `pub fn today(mut self, date: CalendarDate) -> Self`. Sets today's date, as the host's clock and time zone give it. - `pub fn wheel_speed(mut self, speed: WheelSpeed) -> Self`. Sets this frame's wheel speed. - `pub fn alt_code_pages(mut self, pages: AltCodePages) -> Self`. Sets the code pages that decode Alt+numpad codes. + - `pub fn ctrl_wheel_pinch(mut self, pinch: bool) -> Self`. Sets whether a fractional Ctrl+wheel arrives as a pinch (`ctrl_wheel_pinch`). - `craft_ui::runtime::env::RowPressed`: `pub enum RowPressed { Row, Cell(ColumnKey), Part { was_lead: bool } }`. Where the collection holds a primary press on a row, within slop, or the press a part of the row holds. - `craft_ui::runtime::env::Scale`: `pub struct Scale(pub f32)`. The interface scale: pixels per point. - `pub const fn new(pixels_per_point: f32) -> Self`. `pixels_per_point` pixels per point. @@ -3934,6 +4088,7 @@ One-shot screenshot slots and the facts a screenshot is measured against. - `pub fn points_per_inch(&self) -> f64`. How many points make an inch in the scope: the app's point-size preference. - `pub fn name(&self, kind: UnitKind) -> Label`. The unit's name in the user's language, as a list of units shows it: Pixels, Pixels/Inch. - `pub fn symbol(&self, kind: UnitKind) -> String`. The unit's spelling in the user's language without the number: `mm`, `px`. + - `pub fn affixes(&self, kind: UnitKind) -> (String, String)`. The text before and after the number in the user's language, spacing included: `("", " mm")`, `("", "%")`. - `pub fn text(&self, kind: UnitKind, n: f64, decimals: RangeInclusive) -> String`. `n` of `kind` with between the least and most digits of `decimals` after the decimal mark, in the user's - `pub fn show(&self, kind: UnitKind, n: f64) -> String`. `n` of `kind` with its default digits ([`UnitKind::decimals`]). - `pub fn pixels(&self, n: f64) -> String`. `n` pixels: `12 px`. @@ -3964,7 +4119,9 @@ One-shot screenshot slots and the facts a screenshot is measured against. - `craft_ui::runtime::env::WordTemplate`: re-export of `craft_i18n::WordTemplate` (outside these crates). - `craft_ui::runtime::env::Words`: re-export of `craft_i18n::Words` (outside these crates). - `craft_ui::runtime::env::WordsOverride`: `pub enum WordsOverride { Replace(Arc), Overlay(WordRows) }`. How a scope changes the built-in text: the only override path for words. +- `craft_ui::runtime::env::in_room`: `pub fn in_room(ui: &mut Ui, rect: Rect, body: impl FnOnce(&mut Ui) -> R) -> R`. Runs `body` in a child `Ui` held to `rect` and clipped to it, as a layout room of its own: the flow grid, content - `craft_ui::runtime::env::system_appearance`: `pub fn system_appearance(ctx: &Context) -> SystemState`. What the OS reports on `ctx` now: the host's reader (`InstallSpec::system`), with the colour scheme egui's +- `craft_ui::runtime::env::system_text_scale`: `pub fn system_text_scale(ctx: &Context) -> Option`. The desktop text scale from the installed [`SystemReader`], `None` where the OS gives none. - `craft_ui::runtime::env::with_env`: `pub fn with_env(ui: &mut Ui, set: impl FnOnce(&mut Overrides), body: impl FnOnce(&mut Ui) -> R) -> R`. Runs `body` in a child `Ui` with `set`'s changes applied to the inherited values. A scope that disables ## `craft_ui::runtime::focus` @@ -3975,6 +4132,7 @@ The focus service: stops, scopes and roving groups registered per pass, the focu - `craft_ui::runtime::focus::FocusShape`: `pub enum FocusShape { Rect, Circle, Polygon(Vec) }`. The shape the focus ring takes around a part. - `craft_ui::runtime::focus::has`: `pub fn has(ctx: &Context, id: Id) -> bool`. Whether focus is on the component `id` or on one of its parts (a canvas's editor part), from the focus record of - `craft_ui::runtime::focus::host_canvas`: `pub fn host_canvas(ctx: &Context, id: Id, keys: KeyUse)`. Registers the app's own egui widget `id`, drawn in the running pass, as its window's document canvas: its focus stop +- `craft_ui::runtime::focus::is_focused`: `pub fn is_focused(ctx: &Context, id: Id) -> bool`. Whether the focus stop is the component `id`: the focused member or item of its arena, or a root that - `craft_ui::runtime::focus::request`: `pub fn request(ctx: &Context, target: FocusTarget) -> bool`. Moves focus to `target`, leaves modality unchanged and asks the enclosing scroll owner to reveal it. Called - `craft_ui::runtime::focus::takes_letters`: `pub fn takes_letters(keys: &KeyUse) -> bool`. Whether a stop with these keys takes typed letters: a text field or a shortcut recorder. The letters a keytip or a - `craft_ui::runtime::focus::ActivateKeys`: `pub enum ActivateKeys { Neither, Enter, Space, Both }`. The keys that activate a component. @@ -3987,7 +4145,7 @@ The focus service: stops, scopes and roving groups registered per pass, the focu - `pub const fn contains(self, command: EditCommand) -> bool`. Whether the set has `command`. - `craft_ui::runtime::focus::EndKey`: `pub enum EndKey { LastItem, EndMode }`. What a bare End means for a focused component. - `craft_ui::runtime::focus::EnterRule`: `pub enum EnterRule { Pass, Submit }`. What Enter does in a scope after the focused component declined it. -- `craft_ui::runtime::focus::FocusPolicy`: `pub struct FocusPolicy { pub kind: ScopeKind, pub trap: bool, pub restore: bool, pub initial: Initial, pub enter: EnterRule, pub cancel: CancelRule, pub pages: bool, pub list_enter: bool, pub list: Option }`. A focus scope's rules. +- `craft_ui::runtime::focus::FocusPolicy`: `pub struct FocusPolicy { pub kind: ScopeKind, pub trap: bool, pub restore: bool, pub initial: Initial, pub enter: EnterRule, pub cancel: CancelRule, pub pages: bool, pub list_enter: bool, pub list: Option, pub escape_keeps_typing: bool }`. A focus scope's rules. - `pub const NONE: FocusPolicy`. A scope that changes nothing. - `pub const PANE: FocusPolicy`. A pane: an F6 stop. - `pub const DIALOG: FocusPolicy`. A dialog: Tab stays inside, Enter submits, Escape closes. @@ -4000,14 +4158,16 @@ The focus service: stops, scopes and roving groups registered per pass, the focu - `pub const fn cancel(mut self, cancel: CancelRule) -> Self`. What Escape does. - `pub const fn list_enter(mut self, on: bool) -> Self`. Whether Enter on a text opener activates the layer's list. - `pub const fn list(mut self, list: Id) -> Self`. The collection in the layer that takes the opener's list keys. + - `pub const fn escape_keeps_typing(mut self, on: bool) -> Self`. Whether Escape in this dialog keeps the focused field's typing ([`FocusPolicy::escape_keeps_typing`]). - `pub const fn pages(mut self, on: bool) -> Self`. Whether Ctrl+Tab cycles pages. +- `craft_ui::runtime::focus::FocusRequest`: `pub enum FocusRequest { Take, WhenNone }`. A one-shot request for focus on a component's stop (`Props::request_focus`), for what opens without a layer of its - `craft_ui::runtime::focus::FocusTarget`: `pub enum FocusTarget { Id(Id), Part(Id, PartRef), Doc(DocKey) }`. What `runtime::focus::request` focuses. - `craft_ui::runtime::focus::Initial`: `pub enum Initial { Keep, First, FirstField, Default, Key(&'static str), KeepAnchor }`. Where focus goes the first time a scope is pushed. - `craft_ui::runtime::focus::Intents`: `pub struct Intents`. An owned copy of the intents routed to one id this pass; read through `cx.intents()`. - `pub fn take_digit(&mut self) -> Option`. Takes the next typed digit. - `pub fn take(&mut self, intent: Intent) -> bool`. Takes an intent of the kind of `intent`, once per pass: the first taker gets it. - `pub fn take_exact(&mut self, intent: &Intent) -> bool`. Takes an intent equal to `intent` in every field, once per pass: `Intent::delete(false, Granularity::Grapheme)` - - `pub fn take_move(&mut self) -> Option<(NavMove, MoveMods)>`. Takes the next move. + - `pub fn take_move(&mut self) -> Option<(NavMove, MoveMods)>`. Takes the next move, whichever it is: for a component that acts on every move. A move taken is the component's, - `pub fn take_move_where(&mut self, wanted: impl Fn(NavMove, MoveMods) -> bool) -> Option<(NavMove, MoveMods)>`. Takes the next move that `wanted` accepts; the others stay for a later taker, or for the scroll owner around a - `pub fn take_scroll_access(&mut self, into_view: bool) -> Option`. Takes the next AccessKit request that asks a scroll region to scroll, or with `into_view` to show its target. - `pub fn take_edit(&mut self) -> Option`. Takes the next edit command. @@ -4020,7 +4180,7 @@ The focus service: stops, scopes and roving groups registered per pass, the focu - `pub fn untaken(&self, intent: &Intent) -> bool`. Whether an intent of the kind of `intent` is routed and not taken. - `pub fn take_access(&mut self) -> Option`. Takes the next `Intent::Access` request. - `craft_ui::runtime::focus::KeepKeys`: `pub enum KeepKeys { None, Tab, InlineArrows, BlockArrows }`. The keys a focused component keeps from the key stage. -- `craft_ui::runtime::focus::KeyUse`: `pub struct KeyUse { pub keep: KeepKeys, pub activate: ActivateKeys, pub claims: &'static [Chord], pub edits: EditSet, pub inactive: EditSet, pub owner: OwnerClass, pub value: bool, pub moves: bool, pub chrome_key: bool, pub nudge: bool, pub deletes: bool, pub submits: bool, pub end: EndKey, pub session: bool, pub type_ahead: bool, pub holds_drafts: bool }`. A component's declared keys. +- `craft_ui::runtime::focus::KeyUse`: `pub struct KeyUse { pub keep: KeepKeys, pub activate: ActivateKeys, pub claims: &'static [Chord], pub edits: EditSet, pub inactive: EditSet, pub owner: OwnerClass, pub value: bool, pub moves: bool, pub chrome_key: bool, pub nudge: bool, pub nudge_mods: NudgeMods, pub deletes: bool, pub submits: bool, pub end: EndKey, pub session: bool, pub type_ahead: bool, pub holds_drafts: bool, pub command_keys: bool }`. A component's declared keys. - `pub const TEXT_MULTILINE: KeyUse`. A multi-line text field: Up and Down move the caret. - `pub const CODE: KeyUse`. A code editor: Tab inserts. - `pub const CANVAS: KeyUse`. A document canvas: all arrows, no activation, and the key that marks its window as showing a document. @@ -4028,6 +4188,7 @@ The focus service: stops, scopes and roving groups registered per pass, the focu - `pub const RECORDER: KeyUse`. A shortcut recorder: it takes the arrows of a canvas, but it is no document, so it marks no window and a Tab in - `pub const fn of(input: Input) -> KeyUse`. The default key use of a component that takes `input`. The only place egui key filters start from. - `pub const fn with_holds_drafts(mut self) -> Self`. The same use declaring that a press that would apply the focused draft leaves it unapplied (`holds_drafts`). + - `pub const fn with_command_keys(mut self) -> Self`. The same use letting command chords and function keys run the app's commands while it types (`command_keys`). - `pub const fn with_type_ahead(mut self) -> Self`. The same use taking typed letters as `Intent::Text`. - `pub const fn with_claims(mut self, claims: &'static [Chord]) -> Self`. The same use claiming `claims`. - `pub const fn with_edits(mut self, edits: EditSet) -> Self`. The same use listing `edits`. @@ -4041,9 +4202,16 @@ The focus service: stops, scopes and roving groups registered per pass, the focu - `pub const fn with_end(mut self, end: EndKey) -> Self`. The same use with `end` as the meaning of a bare End. - `pub const fn with_keep(mut self, keep: KeepKeys) -> Self`. The same use with `keep` as the keys it keeps from the key stage. - `pub const fn with_chrome_key(mut self, chrome_key: bool) -> Self`. The same use with `chrome_key` as whether the component marks its window as showing a document: a canvas + - `pub const fn with_nudge_mods(mut self, nudge_mods: NudgeMods) -> Self`. The same use with `nudge_mods` as the modifiers a document canvas acts on with the arrows. - `pub const fn is_document_editor(&self) -> bool`. Whether the component is a document canvas's editor part: the document (`chrome_key`) holding its editor's - `pub fn claims_chord(&self, chord: &Chord) -> bool`. Whether the component claims `chord`. - `craft_ui::runtime::focus::Letters`: `pub enum Letters { None, TypeAhead }`. Whether a roving group matches typed letters to entries. +- `craft_ui::runtime::focus::NudgeMods`: `pub struct NudgeMods`. A set of modifier combinations held with the arrows (`KeyUse::nudge_mods`): each is matched exactly, so Shift alone + - `pub const NONE: NudgeMods`. No arrow. + - `pub const STEPS: NudgeMods`. The plain arrows and the arrows with Shift: the step and the large step every nudge reads. + - `pub const fn with(self, mods: Mods) -> Self`. The same set with `mods` in it. + - `pub const fn union(self, other: NudgeMods) -> Self`. Every combination of either set. + - `pub const fn contains(self, mods: Mods) -> bool`. Whether `mods` is in the set. - `craft_ui::runtime::focus::Roving`: `pub struct Roving { pub shape: NavShape, pub wrap: bool, pub home_end: bool, pub page: Option, pub letters: Letters, pub arrows: Arrows, pub first_column: Option, pub hands_back: bool, pub no_lead: bool, pub keeps_lead_moves: bool }`. A roving group's rules: one Tab stop whose members take moves. - `pub const fn new(shape: NavShape) -> Roving`. A group of `shape` with Home and End, no wrap, no paging and no letters. - `pub const fn wrap(mut self, on: bool) -> Self`. Whether moves wrap. @@ -4064,13 +4232,16 @@ The focus service: stops, scopes and roving groups registered per pass, the focu The frame plugin: the per-pass and per-frame steps, with the inputs the app sets and the outputs it drains. - `craft_ui::runtime::frame::ChromeToggle`: `pub enum ChromeToggle { Panels, PanelsKeepTools, ShowPanels, Reveal(Option) }`. Which panels a window's chrome toggle hides (spec 1.8): the `window.toggle_panels` and -- `craft_ui::runtime::frame::FrameInput`: `pub struct FrameInput { pub root: RootEnv, pub commands: CommandInput, pub host: Option>, pub latched: Mods }`. What the app sets before each frame. +- `craft_ui::runtime::frame::FrameInput`: `pub struct FrameInput { pub root: RootEnv, pub commands: CommandInput, pub host: Option>, pub latched: Mods, pub app_modal: Option, pub window_input: WindowInput }`. What the app sets before each frame. - `pub fn new(root: RootEnv) -> Self`. A frame with `root` and no host. + - `pub fn window_input(mut self, window_input: WindowInput) -> Self`. Sets whether the window system's input reaches the hosted windows. - `pub fn commands(mut self, commands: CommandInput) -> Self`. Sets the command input. - `pub fn latched(mut self, mods: Mods) -> Self`. Sets the modifiers latched beyond the window's input. + - `pub fn app_modal(mut self, viewport: Option) -> Self`. Sets the window in which the app's own egui code shows a modal ([`FrameInput::app_modal`](Self::app_modal)). - `pub fn host(mut self, host: Arc) -> Self`. Sets the host: the same `Arc` every frame, a new one to switch (see [`FrameInput::host`](Self::host)). -- `craft_ui::runtime::frame::FrameOutput`: `pub struct FrameOutput { pub fired: Vec, pub delivered: Vec, pub dimmed: Vec, pub announcements: Vec, pub chrome_toggles: Vec<(ViewportId, ChromeToggle)>, pub removed_gestures: Vec, pub outer_edits: Vec, pub refused: bool, pub ended_previews: Vec }`. What the runtime accumulated since the last `take_output`, across passes and discarded passes. +- `craft_ui::runtime::frame::FrameOutput`: `pub struct FrameOutput { pub fired: Vec, pub delivered: Vec, pub dimmed: Vec, pub declined: Vec, pub announcements: Vec, pub chrome_toggles: Vec<(ViewportId, ChromeToggle)>, pub removed_gestures: Vec, pub outer_edits: Vec, pub refused: bool, pub ended_previews: Vec }`. What the runtime accumulated since the last `take_output`, across passes and discarded passes. - `craft_ui::runtime::frame::OuterEdit`: `pub enum OuterEdit { Begin { id: GestureId, label: Arc, doc_key: Option }, Commit { id: GestureId }, Cancel { id: GestureId } }`. A step of the outer gesture of a container whose `ContainerProps::outer_edit` is on: one undo step over the edits of +- `craft_ui::runtime::frame::WindowInput`: `pub enum WindowInput { Live, Dropped }`. Whether the window system's input reaches the OS windows the runtime hosts beside the root (a panel floated into - `craft_ui::runtime::frame::clock`: `pub fn clock(ctx: &Context) -> f64`. The running pass's time in seconds, the same on every pass of a frame: for app code that times a wait. Content - `craft_ui::runtime::frame::discard_pass`: `pub fn discard_pass(ctx: &Context, reason: &'static str)`. Discards the running pass, so nothing of it paints, and runs it again, when [`discardable`]: for a host that learns - `craft_ui::runtime::frame::discardable`: `pub fn discardable(ctx: &Context) -> bool`. Whether the running pass can still be discarded: egui runs a bounded number of passes a frame, and a discard asked @@ -4127,7 +4298,7 @@ Decision records and findings. Inspected regions ([`record`]) collect pipeline s - `pub fn frame_layers(mut self, painter: Option) -> Self`. Sets the end hook's ghost-layer painter. - `craft_ui::runtime::install::WheelModifiers`: `pub struct WheelModifiers { pub zoom: egui::Modifiers, pub sideways: egui::Modifiers }`. The modifiers the mouse wheel zooms and scrolls sideways with. - `pub const fn new(zoom: egui::Modifiers, sideways: egui::Modifiers) -> Self`. The wheel zooms with `zoom` held and scrolls sideways with `sideways` held. -- `craft_ui::runtime::install::install`: `pub fn install(ctx: &Context, spec: InstallSpec) -> Result<(), InstallError>`. Adds the runtime plugin to `ctx` and sets the egui options the runtime owns: interface scale is a command, quit goes +- `craft_ui::runtime::install::install`: `pub fn install(ctx: &Context, spec: InstallSpec) -> Result<(), InstallError>`. Adds the runtime plugin to `ctx` and sets the egui options the runtime owns: the interface scale is the app's ## `craft_ui::runtime::keys` @@ -4140,7 +4311,7 @@ The key stage (spec 9.1, 9.2, 9.3, 9.7): the input hook strips the keys the runt - `pub fn take_digit(&mut self) -> Option`. Takes the next typed digit. - `pub fn take(&mut self, intent: Intent) -> bool`. Takes an intent of the kind of `intent`, once per pass: the first taker gets it. - `pub fn take_exact(&mut self, intent: &Intent) -> bool`. Takes an intent equal to `intent` in every field, once per pass: `Intent::delete(false, Granularity::Grapheme)` - - `pub fn take_move(&mut self) -> Option<(NavMove, MoveMods)>`. Takes the next move. + - `pub fn take_move(&mut self) -> Option<(NavMove, MoveMods)>`. Takes the next move, whichever it is: for a component that acts on every move. A move taken is the component's, - `pub fn take_move_where(&mut self, wanted: impl Fn(NavMove, MoveMods) -> bool) -> Option<(NavMove, MoveMods)>`. Takes the next move that `wanted` accepts; the others stay for a later taker, or for the scroll owner around a - `pub fn take_scroll_access(&mut self, into_view: bool) -> Option`. Takes the next AccessKit request that asks a scroll region to scroll, or with `into_view` to show its target. - `pub fn take_edit(&mut self) -> Option`. Takes the next edit command. @@ -4159,7 +4330,8 @@ The key stage (spec 9.1, 9.2, 9.3, 9.7): the input hook strips the keys the runt - `craft_ui::runtime::keys::focus_holds`: `pub fn focus_holds(ctx: &Context, chord: Chord) -> bool`. Whether the focused component of the running viewport holds a press of `chord`, as routing decides for the press: - `craft_ui::runtime::keys::held`: `pub fn held(ctx: &Context) -> Vec`. The keys down in the running viewport this pass: the key stage's `down` (withheld presses included), plus each key - `craft_ui::runtime::keys::textless_paste`: `pub fn textless_paste(ctx: &Context) -> bool`. Whether the running viewport's input hook read a paste with no text in this pass: the paste chord came while the -- `craft_ui::runtime::keys::with_window_intents`: `pub fn with_window_intents(ctx: &Context, rtl: bool, take: impl FnOnce(&mut Intents) -> bool) -> bool`. Offers the window's intents to `take` while nothing in the window has framework focus or the focused stop is the +- `craft_ui::runtime::keys::with_canvas_window_intents`: `pub fn with_canvas_window_intents(ctx: &Context, rtl: bool, take: impl FnOnce(&mut Intents) -> bool) -> bool`. Offers window intents to a canvas while the canvas or one of its controls has focus, or nothing has focus. +- `craft_ui::runtime::keys::with_window_intents`: `pub fn with_window_intents(ctx: &Context, rtl: bool, take: impl FnOnce(&mut Intents) -> bool) -> bool`. Offers the window's intents and the focused framework stop's unused Escape to `take`, and writes back what it ## `craft_ui::runtime::layout_memory` @@ -4253,10 +4425,11 @@ The layer stack (15.2): the record of the egui layers shown, their order and the - `craft_ui::runtime::overlay::Rank`: `pub enum Rank { Window, Toast, Popup, Modal { backdrop: Backdrop }, ModalChrome, Tooltip }`. An overlay's place in the order. `Rank` is the only place a layer's egui order is chosen. - `pub const fn modal(backdrop: Backdrop) -> Rank`. A modal rank with `backdrop`. - `craft_ui::runtime::overlay::any_open`: `pub fn any_open(ctx: &Context, filter: OpenFilter) -> bool`. Whether any layer of the running viewport that `filter` counts was shown last frame. -- `craft_ui::runtime::overlay::close_popups`: `pub fn close_popups(ctx: &Context)`. Queues a close of every popup layer of the running viewport shown last frame: its menus, dropdowns and lists. The +- `craft_ui::runtime::overlay::close_popups`: `pub fn close_popups(ctx: &Context)`. Queues a close of every popup layer of the running viewport shown last frame that a command closes - `craft_ui::runtime::overlay::family`: `pub fn family(ctx: &Context, id: Id) -> SmallVec<[Id; 4]>`. `id` and everything opened from inside it, shown last frame. - `craft_ui::runtime::overlay::is_open`: `pub fn is_open(ctx: &Context, id: Id) -> bool`. Whether the layer `id` was shown last frame. - `craft_ui::runtime::overlay::pressed_outside`: `pub fn pressed_outside(ctx: &Context, id: Id) -> bool`. Whether a primary press landed outside the layer `id` in this pass while its dismissal kept it open. +- `craft_ui::runtime::overlay::raise`: `pub fn raise(ctx: &Context, id: Id)`. Brings the family of the open layer `id` in front of the other families of its class at the end of this pass, as a - `craft_ui::runtime::overlay::request_close`: `pub fn request_close(ctx: &Context, id: Id, why: CloseReason)`. Queues a close of the layer `id` (a popup or a container). The owner's step 9 or `OverlayUi::show` collects it and - `craft_ui::runtime::overlay::top`: `pub fn top(ctx: &Context) -> Option`. The layer that receives Cancel: the newest member of the topmost family that takes keys. @@ -4286,7 +4459,8 @@ Background results (14): one result per key in runtime memory, produced by a job The pointer snapshot, press targets, the shape record and press cancels (8.1, 8.3). -- `craft_ui::runtime::pointer::PointerFrame`: `pub struct PointerFrame { pub pos: Option, pub delta: Vec2, pub buttons: Buttons, pub press: Option, pub release: Option, pub mods: Mods, pub pick_mods: Mods, pub pick_pos: Option, pub multi_tap: Option, pub time: f64, pub kind: PointerKind, pub sample: Option, pub multi_touch: Option, pub scroll: Vec2, pub zoom: f32, pub rotation: f32, pub slop: f32, pub target: f32 }`. The pointer input of one pass of one viewport, egui-converted. Input enters a frame's first pass only (egui hands +- `craft_ui::runtime::pointer::PointerFrame`: `pub struct PointerFrame { pub pos: Option, pub delta: Vec2, pub buttons: Buttons, pub press: Option, pub press_mods: Option, pub release: Option, pub mods: Mods, pub pick_mods: Mods, pub pick_pos: Option, pub multi_tap: Option, pub time: f64, pub kind: PointerKind, pub sample: Option, pub multi_touch: Option, pub scroll: Vec2, pub zoom: f32, pub rotation: f32, pub slop: f32, pub target: f32 }`. The pointer input of one pass of one viewport, egui-converted. Input enters a frame's first pass only (egui hands +- `craft_ui::runtime::pointer::active_part`: `pub fn active_part(ctx: &Context, owner: Id) -> Option`. The part of `owner` holding the pointer's hover or an open press in this viewport. - `craft_ui::runtime::pointer::frame`: `pub fn frame(ctx: &Context) -> PointerFrame`. The running pass's pointer input. A tracked input (`runtime::inputs`): a memoized view that reads it runs when the - `craft_ui::runtime::pointer::hovers`: `pub fn hovers(ctx: &Context, id: Id) -> bool`. Whether a shape the component `id` registered shows hover in the running pass, by the pass's one resolution of - `craft_ui::runtime::pointer::mods`: `pub fn mods(ctx: &Context) -> Mods`. The modifiers held in the running pass, with the latched ones (`PointerFrame::mods`). A tracked input: a memoized @@ -4332,7 +4506,7 @@ The toast queues: one per window (`WindowKey`), filled from any code with a `Con - `craft_ui::runtime::toast::Card`: `pub struct Card { pub id: ToastId, pub toast: Toast }`. A toast in the queue, as the host reads it. - `craft_ui::runtime::toast::MAX_CARDS`: `pub const MAX_CARDS: usize`. Most cards queued at once per window. Posting past it keeps the new card and drops the oldest earlier card that - `craft_ui::runtime::toast::TIMEOUT`: `pub const TIMEOUT: f32`. How long a toast stays when it names no timeout, in seconds: the source apps' notification duration. -- `craft_ui::runtime::toast::Toast`: `pub struct Toast { pub message: Label, pub timeout: Option, pub politeness: Politeness, pub tone: Tone, pub title: Option