#[repr(C)]pub struct LogicalPosition {
pub x: f32,
pub y: f32,
}
Expand description
A position represented in the coordinate space of logical pixels. That is the space before applying a display device specific scale factor.
Fields§
§x: f32
The x coordinate.
y: f32
The y coordinate.
Implementations§
Source§impl LogicalPosition
impl LogicalPosition
Sourcepub const fn new(x: f32, y: f32) -> Self
pub const fn new(x: f32, y: f32) -> Self
Construct a new logical position from the given x and y coordinates, that are assumed to be in the logical coordinate space.
Sourcepub fn from_physical(physical_pos: PhysicalPosition, scale_factor: f32) -> Self
pub fn from_physical(physical_pos: PhysicalPosition, scale_factor: f32) -> Self
Convert a given physical position to a logical position by dividing the coordinates with the specified scale factor.
Sourcepub fn to_physical(&self, scale_factor: f32) -> PhysicalPosition
pub fn to_physical(&self, scale_factor: f32) -> PhysicalPosition
Convert this logical position to a physical position by multiplying the coordinates with the specified scale factor.
Trait Implementations§
Source§impl Clone for LogicalPosition
impl Clone for LogicalPosition
Source§fn clone(&self) -> LogicalPosition
fn clone(&self) -> LogicalPosition
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 LogicalPosition
impl Debug for LogicalPosition
Source§impl Default for LogicalPosition
impl Default for LogicalPosition
Source§fn default() -> LogicalPosition
fn default() -> LogicalPosition
Returns the “default value” for a type. Read more
Source§impl From<LogicalPosition> for WindowPosition
impl From<LogicalPosition> for WindowPosition
Source§fn from(value: LogicalPosition) -> Self
fn from(value: LogicalPosition) -> Self
Converts to this type from the input type.
Source§impl PartialEq for LogicalPosition
impl PartialEq for LogicalPosition
impl Copy for LogicalPosition
impl StructuralPartialEq for LogicalPosition
Auto Trait Implementations§
impl Freeze for LogicalPosition
impl RefUnwindSafe for LogicalPosition
impl Send for LogicalPosition
impl Sync for LogicalPosition
impl Unpin for LogicalPosition
impl UnwindSafe for LogicalPosition
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