|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--edu.umd.cs.jazz.event.ZEventHandler
|
+--edu.umd.cs.jazz.event.ZNavEventHandlerKeyBoard
ZNavEventHandlerKeyBoard provides event handlers for basic zooming and panning of a Jazz camera with the keyboard. Applications can define which keys are used for navigation, and how much each key moves the camera.
The camera is changed a little bit with each keypress. If a key is held down so it auto-repeats, that is detected, and the camera will then be continuously moved in until the key is released, or another key is pressed at which point it will return to the original behavior of one increment per key press.
The default parameters are: PageUp zooms in PageDown zooms out Arrow keys pan Each keypress zooms in 25%, or pans 25% Each camera change is animated over 250 milliseconds The camera is zoomed around the cursor
| Field Summary | |
protected int |
animTime
|
protected boolean |
autoNav
|
protected float |
autoPanXDelta
|
protected float |
autoPanYDelta
|
protected float |
autoZoomDelta
|
protected int |
delay
|
protected int |
homeKey
|
protected float |
maxMag
|
protected float |
minMag
|
protected float |
panDelta
|
protected int |
panDownKey
|
protected int |
panLeftKey
|
protected int |
panRightKey
|
protected int |
panUpKey
|
protected java.awt.geom.Point2D |
pointerPosition
|
protected int |
prevKeyPress
|
protected float |
scaleDelta
|
protected int |
zoomInKey
|
protected int |
zoomOutKey
|
| Fields inherited from class edu.umd.cs.jazz.event.ZEventHandler |
activated,
component,
keyAdapter,
mouseAdapter,
mouseMotionAdapter,
surface |
| Constructor Summary | |
ZNavEventHandlerKeyBoard(java.awt.Component c,
ZSurface v)
Constructs a new ZNavEventHandlerKeyBoard. |
|
| Method Summary | |
boolean |
isAutoNav()
Return true if currently auto-zooming |
void |
keyPressed(java.awt.event.KeyEvent e)
Key press event handler |
void |
keyReleased(java.awt.event.KeyEvent e)
Key release event handler |
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Watch mouse motion so we always know where the mouse is. |
void |
navOneStep()
Implements auto-navigation |
void |
setHomeKey(int homeKey)
Define the key that is used to home. |
void |
setMaxMagnification(float newMaxMag)
Set the maximum magnification that the camera can be set to with this event handler. |
void |
setMinMagnification(float newMinMag)
Set the minimum magnification that the camera can be set to with this event handler. |
void |
setPanKeys(int leftKey,
int rightKey,
int upKey,
int downKey)
Define the keys that are used to pan. |
void |
setZoomKeys(int inKey,
int outKey)
Define the keys that are used to zoom. |
void |
startAutoNav()
Start the auto navigation |
void |
stopAutoNav()
Stops the auto navigation |
| Methods inherited from class edu.umd.cs.jazz.event.ZEventHandler |
activate,
deactivate,
getCamera,
getComponent,
getSurface,
keyTyped,
mousePressed,
mouseReleased |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected boolean autoNav
protected float scaleDelta
protected float panDelta
protected float autoPanXDelta
protected float autoPanYDelta
protected float autoZoomDelta
protected java.awt.geom.Point2D pointerPosition
protected int animTime
protected int zoomInKey
protected int zoomOutKey
protected int panLeftKey
protected int panRightKey
protected int panUpKey
protected int panDownKey
protected int homeKey
protected int prevKeyPress
protected int delay
protected float minMag
protected float maxMag
| Constructor Detail |
public ZNavEventHandlerKeyBoard(java.awt.Component c,
ZSurface v)
c - The component that this event handler listens to events onv - The surface that is panned| Method Detail |
public void setZoomKeys(int inKey,
int outKey)
inKey - The keycode of the key that should trigger zoom in events.outKey - The keycode of the key that should trigger zoom out events.
public void setPanKeys(int leftKey,
int rightKey,
int upKey,
int downKey)
leftKey - The keycode of the key that should trigger pan left events.rightKey - The keycode of the key that should trigger pan right events.upKey - The keycode of the key that should trigger pan up events.downKey - The keycode of the key that should trigger pan down events.public void setHomeKey(int homeKey)
homeKey - The keycode of the key that should trigger the home event.public void keyPressed(java.awt.event.KeyEvent e)
e - The event.public void keyReleased(java.awt.event.KeyEvent e)
e - The event.public void mouseMoved(java.awt.event.MouseEvent e)
public void mouseDragged(java.awt.event.MouseEvent e)
public boolean isAutoNav()
public void startAutoNav()
public void stopAutoNav()
public void setMinMagnification(float newMinMag)
newMinMag - the new minimum magnificationpublic void setMaxMagnification(float newMaxMag)
newMaxMag - the new maximum magnificationpublic void navOneStep()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||