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)
Constructs a new
MapMover. |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Called when the object has been destroyed.
|
private void |
endMovement()
End the movement.
|
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, mouseExitedprivate EastNorth mousePosMove
private final NavigatableComponent nc
private final JPanel contentPane
private boolean movementInPlace
public MapMover(NavigatableComponent navComp, JPanel contentPane)
MapMover.navComp - the navigatable componentcontentPane - the content panepublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenermouseDragged in class MouseAdapterpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenermousePressed in class MouseAdapterpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenermouseReleased in class MouseAdapterprivate 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 MouseWheelListenermouseWheelMoved in class MouseAdaptere - The wheel event.public void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenermouseMoved in class MouseAdapterpublic void destroy()
Destroyabledestroy in interface Destroyable