Changeset 9584 in osm for applications/viewer/jmapviewer/src/org/openstreetmap
- Timestamp:
- 2008-08-09T12:42:17+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java
r9530 r9584 17 17 * 18 18 */ 19 public class DefaultMapController extends JMapController implements MouseListener, 20 MouseMotionListener, MouseWheelListener { 19 public class DefaultMapController extends JMapController implements 20 MouseListener, MouseMotionListener, MouseWheelListener { 21 22 private static final int MOUSE_BUTTONS_MASK = MouseEvent.BUTTON3_DOWN_MASK 23 | MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK; 21 24 22 25 public DefaultMapController(JMapViewer map) { … … 38 41 if (!movementEnabled || !isMoving) 39 42 return; 40 if (lastDragPoint != null) { 41 Point p = e.getPoint(); 42 int diffx = lastDragPoint.x - p.x; 43 int diffy = lastDragPoint.y - p.y; 44 map.moveMap(diffx, diffy); 43 // Is only right mouse button presed? 44 if ((e.getModifiersEx() & MOUSE_BUTTONS_MASK) == MouseEvent.BUTTON3_DOWN_MASK) { 45 46 if (lastDragPoint != null) { 47 Point p = e.getPoint(); 48 int diffx = lastDragPoint.x - p.x; 49 int diffy = lastDragPoint.y - p.y; 50 map.moveMap(diffx, diffy); 51 } 52 lastDragPoint = e.getPoint(); 45 53 } 46 lastDragPoint = e.getPoint();47 54 } 48 55 49 56 public void mouseClicked(MouseEvent e) { 50 if (doubleClickZoomEnabled && e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) 57 if (doubleClickZoomEnabled && e.getClickCount() == 2 58 && e.getButton() == MouseEvent.BUTTON1) 51 59 map.zoomIn(e.getPoint()); 52 60 }
Note:
See TracChangeset
for help on using the changeset viewer.