agg_gui/widget/app/
touch.rs1use super::super::keyboard_scroll;
7use crate::widget::App;
8
9impl App {
10 pub fn on_touch_start(
11 &mut self,
12 device: crate::touch_state::TouchDeviceId,
13 id: crate::touch_state::TouchId,
14 screen_x: f64,
15 screen_y: f64,
16 force: Option<f32>,
17 ) {
18 let pos = keyboard_scroll::lift_to_world(self.flip_y(screen_x, screen_y));
19 self.touch_state.on_start(device, id, pos, force);
20 crate::touch_state::note_touch_event();
21 }
22 pub fn on_touch_move(
23 &mut self,
24 device: crate::touch_state::TouchDeviceId,
25 id: crate::touch_state::TouchId,
26 screen_x: f64,
27 screen_y: f64,
28 force: Option<f32>,
29 ) {
30 let pos = keyboard_scroll::lift_to_world(self.flip_y(screen_x, screen_y));
31 self.touch_state.on_move(device, id, pos, force);
32 crate::touch_state::note_touch_event();
33 }
34 pub fn on_touch_end(
35 &mut self,
36 device: crate::touch_state::TouchDeviceId,
37 id: crate::touch_state::TouchId,
38 ) {
39 self.touch_state.on_end_or_cancel(device, id);
40 crate::touch_state::note_touch_event();
41 }
42 pub fn on_touch_cancel(
43 &mut self,
44 device: crate::touch_state::TouchDeviceId,
45 id: crate::touch_state::TouchId,
46 ) {
47 self.touch_state.on_end_or_cancel(device, id);
48 crate::touch_state::note_touch_event();
49 }
50 pub fn active_touch_count(&self) -> usize {
55 self.touch_state.active_count()
56 }
57}