/// A Vector3D proportional to the amount scrolled
///
/// Note that this disregards the 3 possible units: this could be expressed in terms of pixels, lines, or pages.
///
/// In most cases, to properly handle scrolling, you should handle all 3 possible enum variants instead of stripping units. Otherwise, if you assume that the units will always be pixels, the user may experience some unexpectedly slow scrolling if their mouse/OS sends values expressed in lines or pages.
/// Construct new coordinates with the specified screen-, client-, element- and page-relative points
pubfnnew(
screen: ScreenPoint,
client: ClientPoint,
element: ElementPoint,
page: PagePoint,
)-> Self{
Self{
screen,
client,
element,
page,
}
}
/// Coordinates relative to the entire screen. This takes into account the window's offset.
pubfnscreen(&self)-> ScreenPoint{
self.screen
}
/// 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.
pubfnclient(&self)-> ClientPoint{
self.client
}
/// 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.)
pubfnelement(&self)-> ElementPoint{
self.element
}
/// 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.)