Change cursor position on touch event

This commit is contained in:
Héctor Ramón Jiménez 2020-12-15 06:44:00 +01:00
parent 3bdf931925
commit 056f7e6951

View File

@ -2,7 +2,7 @@ use crate::conversion;
use crate::{Application, Color, Debug, Mode, Point, Size, Viewport}; use crate::{Application, Color, Debug, Mode, Point, Size, Viewport};
use std::marker::PhantomData; use std::marker::PhantomData;
use winit::event::WindowEvent; use winit::event::{Touch, WindowEvent};
use winit::window::Window; use winit::window::Window;
/// The state of a windowed [`Application`]. /// The state of a windowed [`Application`].
@ -128,7 +128,10 @@ impl<A: Application> State<A> {
self.viewport_version = self.viewport_version.wrapping_add(1); self.viewport_version = self.viewport_version.wrapping_add(1);
} }
WindowEvent::CursorMoved { position, .. } => { WindowEvent::CursorMoved { position, .. }
| WindowEvent::Touch(Touch {
location: position, ..
}) => {
self.cursor_position = *position; self.cursor_position = *position;
} }
WindowEvent::CursorLeft { .. } => { WindowEvent::CursorLeft { .. } => {