public class MapMover extends java.awt.event.MouseAdapter implements Destroyable
| Modifier and Type | Class and Description |
|---|---|
private static class |
MapMover.JMapViewerUpdater |
private class |
MapMover.ZoomerAction |
| Modifier and Type | Field and Description |
|---|---|
private MapViewState.MapViewPoint |
mousePosMoveStart
The point in the map that was the under the mouse point
when moving around started.
|
private NavigatableComponent |
nc
The map to move around.
|
static BooleanProperty |
PROP_ZOOM_REVERSE_WHEEL
Zoom wheel is reversed.
|
private java.util.ArrayList<Pair<MapMover.ZoomerAction,Shortcut>> |
registeredShortcuts |
| Constructor and Description |
|---|
MapMover(NavigatableComponent navComp)
Constructs a new
MapMover. |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Called when the object has been destroyed.
|
private void |
doMoveForDrag(java.awt.event.MouseEvent e) |
private void |
endMovement()
End the movement.
|
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.
|
boolean |
movementInProgress()
Determines if a map move is in progress.
|
private void |
registerActionShortcut(MapMover.ZoomerAction action,
Shortcut shortcut) |
private void |
startMovement(java.awt.event.MouseEvent e)
Start movement by setting a new cursor and remember the current mouse
position.
|
public static final BooleanProperty PROP_ZOOM_REVERSE_WHEEL
private MapViewState.MapViewPoint mousePosMoveStart
null if movement is not activeprivate final NavigatableComponent nc
private final java.util.ArrayList<Pair<MapMover.ZoomerAction,Shortcut>> registeredShortcuts
public MapMover(NavigatableComponent navComp)
MapMover.navComp - the navigatable componentprivate void registerActionShortcut(MapMover.ZoomerAction action, Shortcut shortcut)
public boolean movementInProgress()
true if a map move is in progresspublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenermouseDragged in class java.awt.event.MouseAdapterprivate void doMoveForDrag(java.awt.event.MouseEvent e)
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class java.awt.event.MouseAdapterpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class java.awt.event.MouseAdapterprivate void startMovement(java.awt.event.MouseEvent e)
e - The mouse event that leat to the movement from.private void endMovement()
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved in interface java.awt.event.MouseWheelListenermouseWheelMoved in class java.awt.event.MouseAdaptere - The wheel event.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenermouseMoved in class java.awt.event.MouseAdapterpublic void destroy()
Destroyabledestroy in interface Destroyable