pub struct PopupPlacementInput { /* private fields */ }Expand description
Complete provider-neutral input to popup placement resolution.
All rectangles/sizes/gaps are logical pixels. Construction and builder
calls store values verbatim; resolve_popup_placement validates finite,
non-negative geometry and a non-empty viewport.
§Examples
use ailloli_ui_core::{Rect, Size};
use ailloli_ui_runtime::popup::PopupPlacementInput;
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 10.0, 5.0), Size::new(20.0, 10.0), Rect::new(0.0, 0.0, 100.0, 80.0));
assert!(input.allows_flip());Implementations§
Source§impl PopupPlacementInput
Builder and accessor operations for complete placement resolution input.
impl PopupPlacementInput
Builder and accessor operations for complete placement resolution input.
Sourcepub fn new(anchor: Rect, desired_size: Size, viewport: Rect) -> Self
pub fn new(anchor: Rect, desired_size: Size, viewport: Rect) -> Self
Creates bottom-centered overlay input with zero gap and flipping enabled.
§Examples
use ailloli_ui_core::{Rect, Size};
use ailloli_ui_runtime::popup::{PopupBackend, PopupPlacementInput};
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::new(10.0, 5.0), Rect::new(0.0, 0.0, 100.0, 100.0));
assert_eq!(input.backend(), PopupBackend::Overlay);
assert_eq!(input.gap(), 0.0);Sourcepub const fn anchor(self) -> Rect
pub const fn anchor(self) -> Rect
Returns the stored global logical-pixel anchor.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::PopupPlacementInput;
let anchor = Rect::new(1.0, 2.0, 3.0, 4.0);
assert_eq!(PopupPlacementInput::new(anchor, Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).anchor(), anchor);Sourcepub const fn desired_size(self) -> Size
pub const fn desired_size(self) -> Size
Returns the requested logical-pixel popup size.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::PopupPlacementInput;
let size = Size::new(3.0, 4.0);
assert_eq!(PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), size, Rect::new(0.0, 0.0, 1.0, 1.0)).desired_size(), size);Sourcepub const fn viewport(self) -> Rect
pub const fn viewport(self) -> Rect
Returns the complete global logical-pixel viewport.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::PopupPlacementInput;
let viewport = Rect::new(5.0, 6.0, 100.0, 80.0);
assert_eq!(PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), viewport).viewport(), viewport);Sourcepub const fn placement(self) -> PopupPlacement
pub const fn placement(self) -> PopupPlacement
Returns the preferred vertical side.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::{PopupPlacement, PopupPlacementInput};
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0));
assert_eq!(input.placement(), PopupPlacement::Bottom);Sourcepub const fn alignment(self) -> PopupAlignment
pub const fn alignment(self) -> PopupAlignment
Returns the cross-axis anchor alignment.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::{PopupAlignment, PopupPlacementInput};
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0));
assert_eq!(input.alignment(), PopupAlignment::Center);Sourcepub const fn gap(self) -> f32
pub const fn gap(self) -> f32
Returns the requested logical-pixel gap.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::PopupPlacementInput;
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).with_gap(3.0);
assert_eq!(input.gap(), 3.0);Sourcepub const fn allows_flip(self) -> bool
pub const fn allows_flip(self) -> bool
Returns whether vertical side flipping is enabled.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::PopupPlacementInput;
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).with_flip(false);
assert!(!input.allows_flip());Sourcepub const fn backend(self) -> PopupBackend
pub const fn backend(self) -> PopupBackend
Returns the requested presentation backend.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::{PopupBackend, PopupPlacementInput};
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).with_backend(PopupBackend::Native);
assert_eq!(input.backend(), PopupBackend::Native);Sourcepub const fn with_placement(self, placement: PopupPlacement) -> Self
pub const fn with_placement(self, placement: PopupPlacement) -> Self
Replaces the preferred vertical side.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::{PopupPlacement, PopupPlacementInput};
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).with_placement(PopupPlacement::Top);
assert_eq!(input.placement(), PopupPlacement::Top);Sourcepub const fn with_alignment(self, alignment: PopupAlignment) -> Self
pub const fn with_alignment(self, alignment: PopupAlignment) -> Self
Replaces the cross-axis alignment.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::{PopupAlignment, PopupPlacementInput};
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).with_alignment(PopupAlignment::Start);
assert_eq!(input.alignment(), PopupAlignment::Start);Sourcepub const fn with_gap(self, gap: f32) -> Self
pub const fn with_gap(self, gap: f32) -> Self
Replaces the logical-pixel gap without validating it.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::PopupPlacementInput;
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).with_gap(2.0);
assert_eq!(input.gap(), 2.0);Sourcepub const fn with_flip(self, allow_flip: bool) -> Self
pub const fn with_flip(self, allow_flip: bool) -> Self
Enables or disables automatic vertical flipping.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::PopupPlacementInput;
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).with_flip(false);
assert!(!input.allows_flip());Sourcepub const fn with_backend(self, backend: PopupBackend) -> Self
pub const fn with_backend(self, backend: PopupBackend) -> Self
Replaces the preferred backend; capability fallback occurs at resolve.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::{PopupBackend, PopupPlacementInput};
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::default(), Rect::new(0.0, 0.0, 1.0, 1.0)).with_backend(PopupBackend::Native);
assert_eq!(input.backend(), PopupBackend::Native);Trait Implementations§
Source§impl Clone for PopupPlacementInput
impl Clone for PopupPlacementInput
Source§fn clone(&self) -> PopupPlacementInput
fn clone(&self) -> PopupPlacementInput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PopupPlacementInput
impl Debug for PopupPlacementInput
Source§impl PartialEq for PopupPlacementInput
impl PartialEq for PopupPlacementInput
impl Copy for PopupPlacementInput
impl StructuralPartialEq for PopupPlacementInput
Auto Trait Implementations§
impl Freeze for PopupPlacementInput
impl RefUnwindSafe for PopupPlacementInput
impl Send for PopupPlacementInput
impl Sync for PopupPlacementInput
impl Unpin for PopupPlacementInput
impl UnwindSafe for PopupPlacementInput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.