[−][src]Struct pixel_canvas::input::MouseState
An input handler that tracks the position of the mouse.
It provides physical and virtual coordinates.
- Virtual coordinates (
virtual_xandvirtual_y) are as reported by the OS, which means that they originate from the upper left corner and account for DPI. You don't want this very often, but if you want to match the OS coordinates for some reason, this is it. - Physical coordinates (
xandy) match the pixels in the image. This is usually what you want.
Fields
x: i32The x position from the lower-left corner, measured in physical pixels. This should always correspond to the column of the pixel in the image.
y: i32The y position from the lower-left corner, measured in physical pixels. This should always correspond to the row of the pixel in the image.
virtual_x: i32The x position from the upper-left corner as reported by the OS, measured in virtual pixels.
virtual_y: i32The y position from the upper-left corner as reported by the OS, measured in virtual pixels.
Implementations
impl MouseState[src]
pub fn new() -> Self[src]
Create a MouseState. For use with the state method.
pub fn handle_input(
info: &CanvasInfo,
mouse: &mut MouseState,
event: &Event<'_, ()>
) -> bool[src]
info: &CanvasInfo,
mouse: &mut MouseState,
event: &Event<'_, ()>
) -> bool
Handle input for the mouse. For use with the input method.
Auto Trait Implementations
impl RefUnwindSafe for MouseState
impl Send for MouseState
impl Sync for MouseState
impl Unpin for MouseState
impl UnwindSafe for MouseState
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,