Struct dioxus_html::geometry::Coordinates
source · 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: ScreenPoint,
client: ClientPoint,
element: ElementPoint,
page: PagePoint
) -> Self
pub fn new( screen: ScreenPoint, client: ClientPoint, element: ElementPoint, page: PagePoint ) -> Self
Construct new coordinates with the specified screen-, client-, element- and page-relative points
sourcepub fn screen(&self) -> ScreenPoint
pub fn screen(&self) -> ScreenPoint
Coordinates relative to the entire screen. This takes into account the window’s offset.
sourcepub fn client(&self) -> ClientPoint
pub fn client(&self) -> ClientPoint
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) -> ElementPoint
pub fn element(&self) -> ElementPoint
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) -> PagePoint
pub fn page(&self) -> PagePoint
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.)
Trait Implementations§
source§impl Debug for Coordinates
impl Debug for Coordinates
source§impl PartialEq for Coordinates
impl PartialEq for Coordinates
source§fn eq(&self, other: &Coordinates) -> bool
fn eq(&self, other: &Coordinates) -> bool
self and other values to be equal, and is used
by ==.