pub struct Popper { /* private fields */ }Implementations§
Source§impl Popper
impl Popper
pub fn new(open: Signal<bool>) -> Self
pub fn child<V: View + 'static>(self, child: V) -> Self
pub fn anchor(self, anchor: Anchor) -> Self
pub fn anchor_rect(self, rect: Rect) -> Self
pub fn anchor_view(self, id: ElementId) -> Self
Sourcepub fn anchor_self(self) -> Self
pub fn anchor_self(self) -> Self
Anchors the overlay to the popper’s own layout box.
The popper is usually a zero-sized box in its parent, so this anchors
the overlay near wherever the Popper happens to sit in the tree, not
to the control the user clicked. For a menu or tooltip under a button,
store the button’s ElementId (for example ctx.element() from its
paint pass) and use Self::anchor_view instead; that stays correct
when the button moves or the layout changes.
pub fn at_cursor(self) -> Self
Sourcepub fn anchor_point(self, x: f32, y: f32) -> Self
pub fn anchor_point(self, x: f32, y: f32) -> Self
Anchors the overlay to a fixed screen-space point.
Unlike Self::at_cursor, the point does not follow later pointer
movement. Use this for a context menu that should stay where the user
clicked. The default placement is crate::overlay::Placement::Cursor,
so the overlay’s top-left sits at the point.
Sourcepub fn anchor_static(self, point: Point) -> Self
pub fn anchor_static(self, point: Point) -> Self
Anchors the overlay to a fixed screen-space Point.