RelativePoint
struct · ferroui-base · v0.5.0
struct RelativePoint
Defines a point that may be defined relative to a containing element.
Members
point
point: crate::Point
The point.
unit
unit: RelativeUnit
The unit of the point.
TOP_LEFT
const TOP_LEFT: RelativePoint
A point at the top left of the containing element.
CENTER
const CENTER: RelativePoint
A point at the center of the containing element.
BOTTOM_RIGHT
const BOTTOM_RIGHT: RelativePoint
A point at the bottom right of the containing element.
new
const fn new(x: f64, y: f64, unit: RelativeUnit) -> Self
Initializes a new instance of the RelativePoint structure.
from_point
const fn from_point(point: Point, unit: RelativeUnit) -> Self
Initializes a new instance of the RelativePoint structure from a Point.
equals
fn equals(self: &Self, p: RelativePoint) -> bool
Checks if the RelativePoint equals another point.
to_pixels
fn to_pixels(self: &Self, size: Size) -> Point
Converts a RelativePoint into pixels, using size as the size of the
visual the point is relative to.
to_pixels_rect
fn to_pixels_rect(self: &Self, rect: Rect) -> Point
Converts a RelativePoint into pixels, using rect as the bounding
rectangle the point is relative to.
parse
fn parse(s: &str) -> Result<Self, FormatError>
Parses a RelativePoint string: "x, y" (absolute) or "x%, y%" (relative).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherTransition<RelativePoint>IInterpolator<RelativePoint>From<RelativePoint>ExpressionVariantValueServerPropertyValueBatchValueMarkupTypedValueTypeRegistrationCloneCopyDebugStructuralPartialEqPartialEqDefaultFromStrDisplay
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.