1
2
3
4
5
6
7
8
9
10
11
12
13
14 package com.googlecode.mgwt.dom.client.event.mouse;
15
16 import com.google.gwt.event.dom.client.MouseDownEvent;
17 import com.google.gwt.event.dom.client.MouseDownHandler;
18 import com.googlecode.mgwt.dom.client.event.touch.TouchStartHandler;
19
20
21
22
23
24
25
26 public class TouchStartToMouseDownHandler implements MouseDownHandler {
27
28 private final TouchStartHandler handler;
29
30
31
32
33
34
35
36
37 public TouchStartToMouseDownHandler(TouchStartHandler handler) {
38
39 this.handler = handler;
40
41 }
42
43
44 @Override
45 public void onMouseDown(MouseDownEvent event) {
46 if (event.isAltKeyDown()) {
47 SimulatedTouchStartEvent simulatedTouchStartEvent = new SimulatedTouchStartEvent(event, false);
48 handler.onTouchStart(simulatedTouchStartEvent);
49 simulatedTouchStartEvent = new SimulatedTouchStartEvent(event, true);
50 handler.onTouchStart(simulatedTouchStartEvent);
51 } else {
52 SimulatedTouchStartEvent simulatedTouchStartEvent = new SimulatedTouchStartEvent(event, false);
53 handler.onTouchStart(simulatedTouchStartEvent);
54 }
55
56 }
57
58 }