pub struct AnchoredOverlay<Msg: Clone> { /* private fields */ }Expand description
A wrapper that re-positions its child relative to an anchor widget found in the previous frame’s layout snapshot.
Implementations§
Source§impl<Msg: Clone> AnchoredOverlay<Msg>
impl<Msg: Clone> AnchoredOverlay<Msg>
Sourcepub fn new(
child: impl Into<Element<Msg>>,
anchor_id: WidgetId,
gap: f32,
) -> Self
pub fn new( child: impl Into<Element<Msg>>, anchor_id: WidgetId, gap: f32, ) -> Self
Wrap child so it draws anchored below the widget that carries
anchor_id in its .id( … ) builder. gap is the vertical
space (logical pixels) between the anchor’s bottom edge and the
child’s top edge.
Sourcepub fn gap(self, gap: f32) -> Self
pub fn gap(self, gap: f32) -> Self
The vertical space, in physical pixels, between the anchor’s bottom edge and the child’s top edge. Default: 0.
Sourcepub fn align(self, align: HAlign) -> Self
pub fn align(self, align: HAlign) -> Self
Line the child up with the anchor’s left edge (Start, the default), its right edge (End) or its middle (Center).
Sourcepub fn resolve_rect(anchor: Option<Rect>, gap: f32, fallback: Rect) -> Rect
pub fn resolve_rect(anchor: Option<Rect>, gap: f32, fallback: Rect) -> Rect
Compute the draw rect for the child, given the anchor rect (when available) and the parent-supplied fallback.
Anchor available → place the child flush below the anchor with
gap spacing, preserving the anchor’s width.
Anchor missing → return the parent rect verbatim, so the child
renders modal-style as a fallback.
Trait Implementations§
Source§impl<Msg: Clone + 'static> From<AnchoredOverlay<Msg>> for Element<Msg>
impl<Msg: Clone + 'static> From<AnchoredOverlay<Msg>> for Element<Msg>
Source§fn from(a: AnchoredOverlay<Msg>) -> Self
fn from(a: AnchoredOverlay<Msg>) -> Self
Auto Trait Implementations§
impl<Msg> Freeze for AnchoredOverlay<Msg>
impl<Msg> !RefUnwindSafe for AnchoredOverlay<Msg>
impl<Msg> !Send for AnchoredOverlay<Msg>
impl<Msg> !Sync for AnchoredOverlay<Msg>
impl<Msg> Unpin for AnchoredOverlay<Msg>
impl<Msg> !UnwindSafe for AnchoredOverlay<Msg>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more