public class MapMover extends MouseAdapter implements MouseMotionListener, MouseWheelListener, Destroyable
Modifier and Type | Class and Description |
---|---|
private class |
MapMover.ZoomerAction |
Modifier and Type | Field and Description |
---|---|
private JPanel |
contentPane |
private EastNorth |
mousePosMove
The point in the map that was the under the mouse point
when moving around started.
|
private boolean |
movementInPlace |
private NavigatableComponent |
nc
The map to move around.
|
Constructor and Description |
---|
MapMover(NavigatableComponent navComp,
JPanel contentPane)
Create a new MapMover
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Called when the object has been destroyed.
|
private void |
endMovement()
End the movement.
|
static boolean |
isPlatformOsx()
Replies true if we are currently running on OSX
|
void |
mouseDragged(MouseEvent e)
If the right (and only the right) mouse button is pressed, move the map
|
void |
mouseMoved(MouseEvent e)
Emulates dragging on Mac OSX
|
void |
mousePressed(MouseEvent e)
Start the movement, if it was the 3rd button (right button).
|
void |
mouseReleased(MouseEvent e)
Change the cursor back to it's pre-move cursor.
|
void |
mouseWheelMoved(MouseWheelEvent e)
Zoom the map by 1/5th of current zoom per wheel-delta.
|
private void |
startMovement(MouseEvent e)
Start movement by setting a new cursor and remember the current mouse
position.
|
mouseClicked, mouseEntered, mouseExited
private EastNorth mousePosMove
private final NavigatableComponent nc
private final JPanel contentPane
private boolean movementInPlace
public MapMover(NavigatableComponent navComp, JPanel contentPane)
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class MouseAdapter
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
mousePressed
in class MouseAdapter
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
mouseReleased
in class MouseAdapter
private void startMovement(MouseEvent e)
e
- The mouse event that leat to the movement from.private void endMovement()
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
mouseWheelMoved
in class MouseAdapter
e
- The wheel event.public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class MouseAdapter
public static boolean isPlatformOsx()
public void destroy()
Destroyable
destroy
in interface Destroyable