|
14 | 14 | import gov.nasa.worldwind.geom.LookAt; |
15 | 15 | import gov.nasa.worldwind.gesture.GestureListener; |
16 | 16 | import gov.nasa.worldwind.gesture.GestureRecognizer; |
| 17 | +import gov.nasa.worldwind.gesture.MousePanRecognizer; |
17 | 18 | import gov.nasa.worldwind.gesture.PanRecognizer; |
18 | 19 | import gov.nasa.worldwind.gesture.PinchRecognizer; |
19 | 20 | import gov.nasa.worldwind.gesture.RotationRecognizer; |
@@ -43,17 +44,21 @@ public class BasicWorldWindowController implements WorldWindowController, Gestur |
43 | 44 |
|
44 | 45 | protected GestureRecognizer tiltRecognizer = new PanRecognizer(); |
45 | 46 |
|
| 47 | + protected GestureRecognizer mouseTiltRecognizer = new MousePanRecognizer(); |
| 48 | + |
46 | 49 | protected List<GestureRecognizer> allRecognizers = Arrays.asList( |
47 | | - this.panRecognizer, this.pinchRecognizer, this.rotationRecognizer, this.tiltRecognizer); |
| 50 | + this.panRecognizer, this.pinchRecognizer, this.rotationRecognizer, this.tiltRecognizer, this.mouseTiltRecognizer); |
48 | 51 |
|
49 | 52 | public BasicWorldWindowController() { |
50 | 53 | this.panRecognizer.addListener(this); |
51 | 54 | this.pinchRecognizer.addListener(this); |
52 | 55 | this.rotationRecognizer.addListener(this); |
53 | 56 | this.tiltRecognizer.addListener(this); |
| 57 | + this.mouseTiltRecognizer.addListener(this); |
54 | 58 |
|
55 | 59 | ((PanRecognizer) this.panRecognizer).setMaxNumberOfPointers(2); |
56 | 60 | ((PanRecognizer) this.tiltRecognizer).setMinNumberOfPointers(3); // TODO support for two-finger tilt gestures |
| 61 | + ((MousePanRecognizer) this.mouseTiltRecognizer).setButtonState(MotionEvent.BUTTON_SECONDARY); |
57 | 62 | } |
58 | 63 |
|
59 | 64 | public WorldWindow getWorldWindow() { |
@@ -84,7 +89,7 @@ public void gestureStateChanged(MotionEvent event, GestureRecognizer recognizer) |
84 | 89 | this.handlePinch(recognizer); |
85 | 90 | } else if (recognizer == this.rotationRecognizer) { |
86 | 91 | this.handleRotate(recognizer); |
87 | | - } else if (recognizer == this.tiltRecognizer) { |
| 92 | + } else if (recognizer == this.tiltRecognizer || recognizer == this.mouseTiltRecognizer) { |
88 | 93 | this.handleTilt(recognizer); |
89 | 94 | } |
90 | 95 | } |
|
0 commit comments