pub struct Coordinates { /* private fields */ }
Expand description
Coordinates of a point in the app’s interface
Implementations§
Source§impl Coordinates
impl Coordinates
Sourcepub fn new(
screen: Point2D<f64, ScreenSpace>,
client: Point2D<f64, ClientSpace>,
element: Point2D<f64, ElementSpace>,
page: Point2D<f64, PageSpace>,
) -> Coordinates
pub fn new( screen: Point2D<f64, ScreenSpace>, client: Point2D<f64, ClientSpace>, element: Point2D<f64, ElementSpace>, page: Point2D<f64, PageSpace>, ) -> Coordinates
Construct new coordinates with the specified screen-, client-, element- and page-relative points
Sourcepub fn screen(&self) -> Point2D<f64, ScreenSpace>
pub fn screen(&self) -> Point2D<f64, ScreenSpace>
Coordinates relative to the entire screen. This takes into account the window’s offset.
Sourcepub fn client(&self) -> Point2D<f64, ClientSpace>
pub fn client(&self) -> Point2D<f64, ClientSpace>
Coordinates relative to the application’s viewport (as opposed to the coordinate within the page).
For example, clicking in the top left corner of the viewport will always result in a mouse event with client coordinates (0., 0.), regardless of whether the page is scrolled horizontally.
Sourcepub fn element(&self) -> Point2D<f64, ElementSpace>
pub fn element(&self) -> Point2D<f64, ElementSpace>
Coordinates relative to the padding edge of the target element
For example, clicking in the top left corner of an element will result in element coordinates (0., 0.)
Sourcepub fn page(&self) -> Point2D<f64, PageSpace>
pub fn page(&self) -> Point2D<f64, PageSpace>
Coordinates relative to the entire document. This includes any portion of the document not currently visible.
For example, if the page is scrolled 200 pixels to the right and 300 pixels down, clicking in the top left corner of the viewport would result in page coordinates (200., 300.)