Struct i_slint_core::api::LogicalPosition
source · 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: f32The x coordinate.
y: f32The 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(original: LogicalPosition) -> WindowPosition
fn from(original: LogicalPosition) -> WindowPosition
Converts to this type from the input type.
source§impl PartialEq<LogicalPosition> for LogicalPosition
impl PartialEq<LogicalPosition> for LogicalPosition
source§fn eq(&self, other: &LogicalPosition) -> bool
fn eq(&self, other: &LogicalPosition) -> bool
This method tests for
self and other values to be equal, and is used
by ==.