org.openstreetmap.josm.gui
Class MapMover

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by org.openstreetmap.josm.gui.MapMover
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

public class MapMover
extends java.awt.event.MouseAdapter
implements java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener

Enables moving of the map by holding down the right mouse button and drag the mouse. Also, enables zooming by the mouse wheel.

Author:
imi

Constructor Summary
MapMover(NavigatableComponent navComp, javax.swing.JPanel contentPane)
          Create a new MapMover
 
Method Summary
static boolean isPlatformOsx()
          Replies true if we are currently running on OSX
 void mouseDragged(java.awt.event.MouseEvent e)
          If the right (and only the right) mouse button is pressed, move the map
 void mouseMoved(java.awt.event.MouseEvent e)
          Emulates dragging on Mac OSX
 void mousePressed(java.awt.event.MouseEvent e)
          Start the movement, if it was the 3rd button (right button).
 void mouseReleased(java.awt.event.MouseEvent e)
          Change the cursor back to it's pre-move cursor.
 void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
          Zoom the map by 1/5th of current zoom per wheel-delta.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseEntered, mouseExited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapMover

public MapMover(NavigatableComponent navComp,
                javax.swing.JPanel contentPane)
Create a new MapMover

Method Detail

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
If the right (and only the right) mouse button is pressed, move the map

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class java.awt.event.MouseAdapter

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Start the movement, if it was the 3rd button (right button).

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class java.awt.event.MouseAdapter

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Change the cursor back to it's pre-move cursor.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class java.awt.event.MouseAdapter

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Zoom the map by 1/5th of current zoom per wheel-delta.

Specified by:
mouseWheelMoved in interface java.awt.event.MouseWheelListener
Overrides:
mouseWheelMoved in class java.awt.event.MouseAdapter
Parameters:
e - The wheel event.

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Emulates dragging on Mac OSX

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class java.awt.event.MouseAdapter

isPlatformOsx

public static boolean isPlatformOsx()
Replies true if we are currently running on OSX

Returns:
true if we are currently running on OSX