pub enum PopupAnchor {
ParentRect(Rect),
Pointer,
PointerFixed,
Position(Pos2),
}Expand description
What should we anchor the popup to?
The final position for the popup will be calculated based on RectAlign
and can be customized with Popup::align and Popup::align_alternatives.
PopupAnchor is the parent rect of RectAlign.
For PopupAnchor::Pointer, PopupAnchor::PointerFixed and PopupAnchor::Position,
the rect will be derived via Rect::from_pos (so a zero-sized rect at the given position).
The rect should be in global coordinates. PopupAnchor::from(&response) will automatically
do this conversion.
Variants§
ParentRect(Rect)
Show the popup relative to some parent Rect.
Pointer
Show the popup relative to the mouse pointer.
PointerFixed
Remember the mouse position and show the popup relative to that (like a context menu).
Position(Pos2)
Show the popup relative to a specific position.
Implementations§
Source§impl PopupAnchor
impl PopupAnchor
Sourcepub fn rect(self, popup_id: Id, ctx: &Context) -> Option<Rect>
pub fn rect(self, popup_id: Id, ctx: &Context) -> Option<Rect>
Get the rect the popup should be shown relative to.
Returns Rect::from_pos for PopupAnchor::Pointer, PopupAnchor::PointerFixed
and PopupAnchor::Position (so the rect will be zero-sized).
Trait Implementations§
Source§impl Clone for PopupAnchor
impl Clone for PopupAnchor
Source§fn clone(&self) -> PopupAnchor
fn clone(&self) -> PopupAnchor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more