pub struct LayoutMetrics { /* private fields */ }
Expand description
Layout metrics in a LAYOUT
context.
Implementations§
source§impl LayoutMetrics
impl LayoutMetrics
sourcepub fn new(scale_factor: Factor, viewport: PxSize, font_size: Px) -> Self
pub fn new(scale_factor: Factor, viewport: PxSize, font_size: Px) -> Self
New root LayoutMetrics
.
The font_size
sets both font sizes, the initial PPI is 96.0
, you can use the builder style method and
with_screen_ppi
to set a different value.
sourcepub fn constraints(&self) -> PxConstraints2d
pub fn constraints(&self) -> PxConstraints2d
Current size constraints.
sourcepub fn z_constraints(&self) -> PxConstraints
pub fn z_constraints(&self) -> PxConstraints
Current perspective constraints.
sourcepub fn inline_constraints(&self) -> Option<InlineConstraints>
pub fn inline_constraints(&self) -> Option<InlineConstraints>
Current inline constraints.
Only present if the parent widget supports inline.
sourcepub fn direction(&self) -> LayoutDirection
pub fn direction(&self) -> LayoutDirection
Gets the inline or text flow direction.
sourcepub fn root_font_size(&self) -> Px
pub fn root_font_size(&self) -> Px
Computed font size at the root widget.
sourcepub fn scale_factor(&self) -> Factor
pub fn scale_factor(&self) -> Factor
Pixel scale factor.
sourcepub fn viewport(&self) -> PxSize
pub fn viewport(&self) -> PxSize
Computed size of the nearest viewport ancestor.
This is usually the window content area size, but can be the scroll viewport size or any other value depending on the implementation of the context widgets.
sourcepub fn viewport_min(&self) -> Px
pub fn viewport_min(&self) -> Px
Smallest dimension of the viewport
.
sourcepub fn viewport_max(&self) -> Px
pub fn viewport_max(&self) -> Px
Largest dimension of the viewport
.
sourcepub fn screen_ppi(&self) -> Ppi
pub fn screen_ppi(&self) -> Ppi
The current screen “pixels-per-inch” resolution.
This value is dependent in the actual physical size of the screen.
Default is 96.0
.
sourcepub fn leftover(&self) -> Size2D<Option<Px>, ()>
pub fn leftover(&self) -> Size2D<Option<Px>, ()>
Computed leftover length for the widget, given the Length::Leftover
value it communicated to the parent.
sourcepub fn with_constraints(self, constraints: PxConstraints2d) -> Self
pub fn with_constraints(self, constraints: PxConstraints2d) -> Self
Sets the constraints
to constraints
.
sourcepub fn with_z_constraints(self, constraints: PxConstraints) -> Self
pub fn with_z_constraints(self, constraints: PxConstraints) -> Self
Sets the z_constraints
to constraints
.
sourcepub fn with_inline_constraints(
self,
inline_constraints: Option<InlineConstraints>,
) -> Self
pub fn with_inline_constraints( self, inline_constraints: Option<InlineConstraints>, ) -> Self
Set the inline_constraints
.
sourcepub fn with_font_size(self, font_size: Px) -> Self
pub fn with_font_size(self, font_size: Px) -> Self
Sets the font_size
.
sourcepub fn with_viewport(self, viewport: PxSize) -> Self
pub fn with_viewport(self, viewport: PxSize) -> Self
Sets the viewport
.
sourcepub fn with_scale_factor(self, scale_factor: Factor) -> Self
pub fn with_scale_factor(self, scale_factor: Factor) -> Self
Sets the scale_factor
.
sourcepub fn with_screen_ppi(self, screen_ppi: Ppi) -> Self
pub fn with_screen_ppi(self, screen_ppi: Ppi) -> Self
Sets the screen_ppi
.
sourcepub fn with_direction(self, direction: LayoutDirection) -> Self
pub fn with_direction(self, direction: LayoutDirection) -> Self
Sets the direction
.
sourcepub fn snapshot(&self) -> LayoutMetricsSnapshot
pub fn snapshot(&self) -> LayoutMetricsSnapshot
Clones all current metrics into a snapshot.
Trait Implementations§
source§impl Clone for LayoutMetrics
impl Clone for LayoutMetrics
source§fn clone(&self) -> LayoutMetrics
fn clone(&self) -> LayoutMetrics
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for LayoutMetrics
impl RefUnwindSafe for LayoutMetrics
impl Send for LayoutMetrics
impl Sync for LayoutMetrics
impl Unpin for LayoutMetrics
impl UnwindSafe for LayoutMetrics
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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