pub struct ResolvedPopupPlacement { /* private fields */ }Expand description
Deterministic result of backend and popup geometry resolution.
bounds is a finite rectangle clamped inside the input viewport in global
logical pixels. flipped compares selected/requested side; clamped covers
both size reduction and position correction.
§Examples
use ailloli_ui_core::{Rect, Size};
use ailloli_ui_runtime::popup::{resolve_popup_placement, PopupBackendCapabilities, PopupPlacementInput};
let result = resolve_popup_placement(PopupPlacementInput::new(Rect::new(10.0, 10.0, 10.0, 5.0), Size::new(20.0, 10.0), Rect::new(0.0, 0.0, 100.0, 100.0)), PopupBackendCapabilities::overlay_only())?;
assert_eq!(result.bounds().w, 20.0);Implementations§
Source§impl ResolvedPopupPlacement
Accessors for one immutable placement result.
impl ResolvedPopupPlacement
Accessors for one immutable placement result.
Sourcepub const fn backend(self) -> PopupBackendResolution
pub const fn backend(self) -> PopupBackendResolution
Returns requested/selected backend resolution.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::*;
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 1.0, 1.0), Size::new(1.0, 1.0), Rect::new(0.0, 0.0, 10.0, 10.0)).with_backend(PopupBackend::Native);
assert!(resolve_popup_placement(input, PopupBackendCapabilities::overlay_only())?.backend().fell_back());Sourcepub const fn bounds(self) -> Rect
pub const fn bounds(self) -> Rect
Returns final global logical-pixel bounds.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::*;
let result = resolve_popup_placement(PopupPlacementInput::new(Rect::new(0.0, 0.0, 2.0, 2.0), Size::new(4.0, 3.0), Rect::new(0.0, 0.0, 10.0, 10.0)), PopupBackendCapabilities::overlay_only())?;
assert_eq!(result.bounds().w, 4.0);Sourcepub const fn placement(self) -> PopupPlacement
pub const fn placement(self) -> PopupPlacement
Returns the selected side after optional flipping.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::*;
let input = PopupPlacementInput::new(Rect::new(10.0, 90.0, 5.0, 5.0), Size::new(10.0, 20.0), Rect::new(0.0, 0.0, 100.0, 100.0));
assert_eq!(resolve_popup_placement(input, PopupBackendCapabilities::overlay_only())?.placement(), PopupPlacement::Top);Sourcepub const fn flipped(self) -> bool
pub const fn flipped(self) -> bool
Reports whether resolution selected the opposite vertical side.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::*;
let input = PopupPlacementInput::new(Rect::new(10.0, 90.0, 5.0, 5.0), Size::new(10.0, 20.0), Rect::new(0.0, 0.0, 100.0, 100.0));
assert!(resolve_popup_placement(input, PopupBackendCapabilities::overlay_only())?.flipped());Sourcepub const fn clamped(self) -> bool
pub const fn clamped(self) -> bool
Reports whether desired size or positioned bounds were viewport-corrected.
§Examples
use ailloli_ui_core::{Rect, Size}; use ailloli_ui_runtime::popup::*;
let input = PopupPlacementInput::new(Rect::new(0.0, 0.0, 0.0, 0.0), Size::new(50.0, 50.0), Rect::new(0.0, 0.0, 10.0, 10.0));
assert!(resolve_popup_placement(input, PopupBackendCapabilities::overlay_only())?.clamped());Trait Implementations§
Source§impl Clone for ResolvedPopupPlacement
impl Clone for ResolvedPopupPlacement
Source§fn clone(&self) -> ResolvedPopupPlacement
fn clone(&self) -> ResolvedPopupPlacement
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResolvedPopupPlacement
impl Debug for ResolvedPopupPlacement
Source§impl PartialEq for ResolvedPopupPlacement
impl PartialEq for ResolvedPopupPlacement
impl Copy for ResolvedPopupPlacement
impl StructuralPartialEq for ResolvedPopupPlacement
Auto Trait Implementations§
impl Freeze for ResolvedPopupPlacement
impl RefUnwindSafe for ResolvedPopupPlacement
impl Send for ResolvedPopupPlacement
impl Sync for ResolvedPopupPlacement
impl Unpin for ResolvedPopupPlacement
impl UnwindSafe for ResolvedPopupPlacement
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
Mutably borrows from an owned value. Read more
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.