pub struct AlignmentDirectional {
pub start: f64,
pub y: f64,
}Expand description
An offset that’s expressed as a fraction of a Size, but whose horizontal
component is dependent on the writing direction.
This can be used to indicate an offset from the left in TextDirection::Ltr
text and an offset from the right in TextDirection::Rtl text without
having to be aware of the current text direction.
See also:
Alignment, a variant that is defined in physical terms (i.e. whose horizontal component does not depend on the text direction).
Fields§
§start: f64The distance fraction in the horizontal direction.
A value of -1.0 corresponds to the edge on the “start” side, which is
the left side in TextDirection::Ltr contexts and the right side in
TextDirection::Rtl contexts. A value of 1.0 corresponds to the
opposite edge, the “end” side. Values are not limited to that range;
values less than -1.0 represent positions beyond the start edge, and
values greater than 1.0 represent positions beyond the end edge.
This value is normalized into an Alignment::x value by the
resolve method.
y: f64The distance fraction in the vertical direction.
A value of -1.0 corresponds to the topmost edge. A value of 1.0 corresponds to the bottommost edge. Values are not limited to that range; values less than -1.0 represent positions above the top, and values greater than 1.0 represent positions below the bottom.
This value is passed through to Alignment::y unmodified by the
resolve method.
Implementations§
Source§impl AlignmentDirectional
impl AlignmentDirectional
Sourcepub const TOP_START: AlignmentDirectional
pub const TOP_START: AlignmentDirectional
The top corner on the “start” side.
Sourcepub const TOP_CENTER: AlignmentDirectional
pub const TOP_CENTER: AlignmentDirectional
The center point along the top edge.
Consider using Alignment::TOP_CENTER instead, as it does not need to
be resolved to be used.
Sourcepub const TOP_END: AlignmentDirectional
pub const TOP_END: AlignmentDirectional
The top corner on the “end” side.
Sourcepub const CENTER_START: AlignmentDirectional
pub const CENTER_START: AlignmentDirectional
The center point along the “start” edge.
Sourcepub const CENTER: AlignmentDirectional
pub const CENTER: AlignmentDirectional
The center point, both horizontally and vertically.
Consider using Alignment::CENTER instead, as it does not need to be
resolved to be used.
Sourcepub const CENTER_END: AlignmentDirectional
pub const CENTER_END: AlignmentDirectional
The center point along the “end” edge.
Sourcepub const BOTTOM_START: AlignmentDirectional
pub const BOTTOM_START: AlignmentDirectional
The bottom corner on the “start” side.
Sourcepub const BOTTOM_CENTER: AlignmentDirectional
pub const BOTTOM_CENTER: AlignmentDirectional
The center point along the bottom edge.
Consider using Alignment::BOTTOM_CENTER instead, as it does not need
to be resolved to be used.
Sourcepub const BOTTOM_END: AlignmentDirectional
pub const BOTTOM_END: AlignmentDirectional
The bottom corner on the “end” side.
Sourcepub const fn new(start: f64, y: f64) -> AlignmentDirectional
pub const fn new(start: f64, y: f64) -> AlignmentDirectional
Creates a directional alignment.
Sourcepub fn truncating_div(&self, other: f64) -> AlignmentDirectional
pub fn truncating_div(&self, other: f64) -> AlignmentDirectional
Integer divides the AlignmentDirectional in each dimension by the
given factor.
Sourcepub fn lerp(
a: Option<AlignmentDirectional>,
b: Option<AlignmentDirectional>,
t: f64,
) -> Option<AlignmentDirectional>
pub fn lerp( a: Option<AlignmentDirectional>, b: Option<AlignmentDirectional>, t: f64, ) -> Option<AlignmentDirectional>
Linearly interpolate between two AlignmentDirectionals.
If either is null, this function interpolates from
AlignmentDirectional::CENTER.
Trait Implementations§
Source§impl Add for AlignmentDirectional
impl Add for AlignmentDirectional
Source§type Output = AlignmentDirectional
type Output = AlignmentDirectional
+ operator.Source§fn add(self, other: AlignmentDirectional) -> AlignmentDirectional
fn add(self, other: AlignmentDirectional) -> AlignmentDirectional
+ operation. Read moreSource§impl Clone for AlignmentDirectional
impl Clone for AlignmentDirectional
Source§fn clone(&self) -> AlignmentDirectional
fn clone(&self) -> AlignmentDirectional
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AlignmentDirectional
Source§impl Debug for AlignmentDirectional
impl Debug for AlignmentDirectional
Source§impl Div<f64> for AlignmentDirectional
impl Div<f64> for AlignmentDirectional
Source§type Output = AlignmentDirectional
type Output = AlignmentDirectional
/ operator.Source§impl From<AlignmentDirectional> for AlignmentGeometry
impl From<AlignmentDirectional> for AlignmentGeometry
Source§fn from(alignment: AlignmentDirectional) -> AlignmentGeometry
fn from(alignment: AlignmentDirectional) -> AlignmentGeometry
Source§impl Mul<f64> for AlignmentDirectional
impl Mul<f64> for AlignmentDirectional
Source§type Output = AlignmentDirectional
type Output = AlignmentDirectional
* operator.Source§impl Neg for AlignmentDirectional
impl Neg for AlignmentDirectional
Source§type Output = AlignmentDirectional
type Output = AlignmentDirectional
- operator.Source§fn neg(self) -> AlignmentDirectional
fn neg(self) -> AlignmentDirectional
- operation. Read moreSource§impl PartialEq for AlignmentDirectional
impl PartialEq for AlignmentDirectional
Source§impl Rem<f64> for AlignmentDirectional
impl Rem<f64> for AlignmentDirectional
Source§type Output = AlignmentDirectional
type Output = AlignmentDirectional
% operator.impl StructuralPartialEq for AlignmentDirectional
Source§impl Sub for AlignmentDirectional
impl Sub for AlignmentDirectional
Source§type Output = AlignmentDirectional
type Output = AlignmentDirectional
- operator.Source§fn sub(self, other: AlignmentDirectional) -> AlignmentDirectional
fn sub(self, other: AlignmentDirectional) -> AlignmentDirectional
- operation. Read more