Changeset 9584 in osm for applications/viewer


Ignore:
Timestamp:
2008-08-09T12:42:17+02:00 (16 years ago)
Author:
stotz
Message:

Missing check for right mouse button on movement added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java

    r9530 r9584  
    1717 *
    1818 */
    19 public class DefaultMapController extends JMapController implements MouseListener,
    20                 MouseMotionListener, MouseWheelListener {
     19public 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;
    2124
    2225        public DefaultMapController(JMapViewer map) {
     
    3841                if (!movementEnabled || !isMoving)
    3942                        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();
    4553                }
    46                 lastDragPoint = e.getPoint();
    4754        }
    4855
    4956        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)
    5159                        map.zoomIn(e.getPoint());
    5260        }
Note: See TracChangeset for help on using the changeset viewer.