A menu with a companion bar enables its end region so the bar runs; the selection-bar trial's frame leaves room above for the bar

This commit is contained in:
Martin Ball
2026-11-18 14:34:21 +00:00
parent 87b0a9cfa3
commit c31a242a26
2 changed files with 5 additions and 3 deletions
@@ -107,9 +107,10 @@ fn picked(pick: &Rc<RefCell<Pick>>) -> Pick {
pick.borrow().clone()
}
/// A pick over a frame lowered to leave room above it for the bar, so the bar hangs above until `at_top` moves it.
fn new_pick(dismiss: TaskBarDismiss, at_top: bool) -> Rc<RefCell<Pick>> {
Rc::new(RefCell::new(Pick {
anchor: frame(DocVec::ZERO),
anchor: frame(DocVec::new(0.0, 80.0)),
at_top,
dismiss,
bounds: Rect::NOTHING,
+3 -2
View File
@@ -5,7 +5,7 @@ use super::level::{LevelMemory, MenuLevel, level_env};
use super::words::MenuWords;
use crate::contract::overlay::{Anchor, Dismiss, Outside, Place, Popup};
use crate::contract::{
Bind, BindMut, BodyCx, Common, Component, Container, ContainerProps, Cx, Entry, Focus as _, Gap, InMenu, LeastWidth, Mount, NoValue, Outcome,
Bind, BindMut, BodyCx, Common, Component, Container, ContainerProps, Cx, EndRegion, Entry, Focus as _, Gap, InMenu, LeastWidth, Mount, NoValue, Outcome,
Overlay, POPUP_PAD, Pad, Pointer as _, Props as _, Remember as _, Role, Scroll, Show as _, ShowContainer as _, Sizing, TooltipSpec, Trigger,
};
use crate::display::Divider;
@@ -176,10 +176,11 @@ pub struct Menu<'a> {
impl<'a> Menu<'a> {
/// A modeless bar layer above the menu, in its press family; it closes with the menu, and Escape closes the top
/// layer first.
/// layer first. The bar runs in the menu's end region, which the layer leaves empty in flow, so it takes no room.
#[must_use]
pub fn companion(mut self, bar: &'a mut dyn FnMut(&mut Ui)) -> Self {
self.companion = Some(bar);
self.props = self.props.end(EndRegion::new());
self
}