Struct pixel_canvas::input::MouseState
source · [−]Expand description
An input handler that tracks the position of the mouse.
It provides physical and virtual coordinates.
- Virtual coordinates (
virtual_x
andvirtual_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 (
x
andy
) match the pixels in the image. This is usually what you want.
Fields
x: i32
The 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: i32
The 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: i32
The x position from the upper-left corner as reported by the OS, measured in virtual pixels.
virtual_y: i32
The y position from the upper-left corner as reported by the OS, measured in virtual pixels.
Implementations
sourceimpl MouseState
impl MouseState
sourcepub fn handle_input(
info: &CanvasInfo,
mouse: &mut MouseState,
event: &Event<'_, ()>
) -> bool
pub fn handle_input(
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more