pub struct RelativePoint {
pub point: Point,
pub unit: RelativeUnit,
}Expand description
Defines a point that may be defined relative to a containing element.
Fields§
§point: PointThe point.
unit: RelativeUnitThe unit of the point.
Implementations§
Source§impl RelativePoint
impl RelativePoint
Sourcepub const TOP_LEFT: RelativePoint
pub const TOP_LEFT: RelativePoint
A point at the top left of the containing element.
Sourcepub const CENTER: RelativePoint
pub const CENTER: RelativePoint
A point at the center of the containing element.
Sourcepub const BOTTOM_RIGHT: RelativePoint
pub const BOTTOM_RIGHT: RelativePoint
A point at the bottom right of the containing element.
Sourcepub const fn new(x: f64, y: f64, unit: RelativeUnit) -> Self
pub const fn new(x: f64, y: f64, unit: RelativeUnit) -> Self
Initializes a new instance of the RelativePoint structure.
Sourcepub const fn from_point(point: Point, unit: RelativeUnit) -> Self
pub const fn from_point(point: Point, unit: RelativeUnit) -> Self
Initializes a new instance of the RelativePoint structure from a Point.
Sourcepub fn equals(&self, p: RelativePoint) -> bool
pub fn equals(&self, p: RelativePoint) -> bool
Checks if the RelativePoint equals another point.
Sourcepub fn to_pixels(&self, size: Size) -> Point
pub fn to_pixels(&self, size: Size) -> Point
Converts a RelativePoint into pixels, using size as the size of the
visual the point is relative to.
Sourcepub fn to_pixels_rect(&self, rect: Rect) -> Point
pub fn to_pixels_rect(&self, rect: Rect) -> Point
Converts a RelativePoint into pixels, using rect as the bounding
rectangle the point is relative to.
Sourcepub fn parse(s: &str) -> Result<Self, FormatError>
pub fn parse(s: &str) -> Result<Self, FormatError>
Parses a RelativePoint string: "x, y" (absolute) or "x%, y%" (relative).
Trait Implementations§
Source§impl BatchValue for RelativePoint
impl BatchValue for RelativePoint
Source§impl Clone for RelativePoint
impl Clone for RelativePoint
impl Copy for RelativePoint
Source§impl Debug for RelativePoint
impl Debug for RelativePoint
Source§impl Default for RelativePoint
impl Default for RelativePoint
Source§impl Display for RelativePoint
impl Display for RelativePoint
Source§impl ExpressionVariantValue for RelativePoint
impl ExpressionVariantValue for RelativePoint
Source§const FFI_VARIANT_TYPE: Option<VariantType>
const FFI_VARIANT_TYPE: Option<VariantType>
The variant type a foreign function parameter of this type is matched
against, or
None when the type cannot be a foreign function parameter.Source§fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
Source§fn into_variant(self) -> ExpressionVariant
fn into_variant(self) -> ExpressionVariant
Source§impl From<RelativePoint> for ExpressionVariant
impl From<RelativePoint> for ExpressionVariant
Source§fn from(value: RelativePoint) -> ExpressionVariant
fn from(value: RelativePoint) -> ExpressionVariant
Converts to this type from the input type.
Source§impl FromStr for RelativePoint
impl FromStr for RelativePoint
Source§impl IInterpolator<RelativePoint> for RelativePointInterpolator
impl IInterpolator<RelativePoint> for RelativePointInterpolator
fn interpolate( &self, from: RelativePoint, to: RelativePoint, progress: f32, ) -> RelativePoint
Source§impl MarkupTyped for RelativePoint
impl MarkupTyped for RelativePoint
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
The markup metadata of the type.
Source§impl PartialEq for RelativePoint
impl PartialEq for RelativePoint
Source§impl ServerPropertyValue for RelativePoint
impl ServerPropertyValue for RelativePoint
impl StructuralPartialEq for RelativePoint
Source§impl Transition<RelativePoint> for RelativePointTransition
impl Transition<RelativePoint> for RelativePointTransition
Source§fn do_transition(
this: &Self,
progress: Rc<dyn IObservable<f64>>,
old_value: RelativePoint,
new_value: RelativePoint,
) -> Rc<dyn IObservable<RelativePoint>>
fn do_transition( this: &Self, progress: Rc<dyn IObservable<f64>>, old_value: RelativePoint, new_value: RelativePoint, ) -> Rc<dyn IObservable<RelativePoint>>
Creates the observable of the values of the transition from
old_value to new_value, driven by progress (from 0 to 1).Auto Trait Implementations§
impl Freeze for RelativePoint
impl RefUnwindSafe for RelativePoint
impl Send for RelativePoint
impl Sync for RelativePoint
impl Unpin for RelativePoint
impl UnsafeUnpin for RelativePoint
impl UnwindSafe for RelativePoint
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more