···
use tokio::sync::{OnceCell, mpsc};
application::ApplicationHandler,
-
event::{ElementState, MouseButton, WindowEvent},
event_loop::{ActiveEventLoop, ControlFlow, EventLoop},
window::{Window, WindowAttributes, WindowId},
···
WindowEvent::CloseRequested => {
WindowEvent::MouseInput { state, button, .. } => {
if button == MouseButton::Left {
···
use tokio::sync::{OnceCell, mpsc};
application::ApplicationHandler,
+
event::{ElementState, MouseButton, TouchPhase, WindowEvent},
event_loop::{ActiveEventLoop, ControlFlow, EventLoop},
window::{Window, WindowAttributes, WindowId},
···
WindowEvent::CloseRequested => {
+
WindowEvent::Touch(touch) => {
+
let pos = (touch.location.x as f32, touch.location.y as f32);
+
TouchPhase::Started => {
+
self.handle_mouse_press(pos);
+
self.handle_mouse_move(pos);
+
TouchPhase::Ended | TouchPhase::Cancelled => {
+
self.handle_mouse_release();
WindowEvent::MouseInput { state, button, .. } => {
if button == MouseButton::Left {