edu.umd.cs.jazz.event
Class ZoomEventHandlerRightButton

java.lang.Object
  |
  +--edu.umd.cs.jazz.event.ZEventHandler
        |
        +--edu.umd.cs.jazz.event.ZoomEventHandlerRightButton

public class ZoomEventHandlerRightButton
extends ZEventHandler

ZoomEventhandlerRightButton provides event handlers for basic zooming of a Jazz camera with the right button. The interaction is that the initial mouse press defines the zoom anchor point, and then moving the mouse to the right zooms with a speed proportional to the amount the mouse is moved to the right of the anchor point. Similarly, if the mouse is moved to the left, the the camera is zoomed out.


Field Summary
protected  java.awt.geom.Point2D pressObjPt
           
protected  float pressWinX
           
protected  float scaleDelta
           
protected  boolean zooming
           
 
Fields inherited from class edu.umd.cs.jazz.event.ZEventHandler
activated, component, keyAdapter, mouseAdapter, mouseMotionAdapter, surface
 
Constructor Summary
ZoomEventHandlerRightButton(java.awt.Component c, ZSurface v)
          Constructs a new ZoomEventHandlerRightButton.
 
Method Summary
 void mouseDragged(java.awt.event.MouseEvent e)
          Mouse drag event handler
 void mousePressed(java.awt.event.MouseEvent e)
          Mouse press event handler
 void mouseReleased(java.awt.event.MouseEvent e)
          Mouse release event handler
 void startZooming()
          Start animated zooming.
 void stopZooming()
          Stop animated zooming.
 void zoomOneStep()
          Do one zooming step, sleep a short amount, and schedule the next zooming step.
 
Methods inherited from class edu.umd.cs.jazz.event.ZEventHandler
activate, deactivate, getCamera, getComponent, getSurface, keyPressed, keyReleased, keyTyped, mouseMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scaleDelta

protected float scaleDelta

pressWinX

protected float pressWinX

pressObjPt

protected java.awt.geom.Point2D pressObjPt

zooming

protected boolean zooming
Constructor Detail

ZoomEventHandlerRightButton

public ZoomEventHandlerRightButton(java.awt.Component c,
                                   ZSurface v)
Constructs a new ZoomEventHandlerRightButton.
Parameters:
c - The component that this event handler listens to events on
v - The camera that is panned
Method Detail

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Mouse press event handler
Parameters:
e - The event.
Overrides:
mousePressed in class ZEventHandler

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Mouse drag event handler
Parameters:
e - The event.
Overrides:
mouseDragged in class ZEventHandler

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Mouse release event handler
Parameters:
e - The event.
Overrides:
mouseReleased in class ZEventHandler

startZooming

public void startZooming()
Start animated zooming.

stopZooming

public void stopZooming()
Stop animated zooming.

zoomOneStep

public void zoomOneStep()
Do one zooming step, sleep a short amount, and schedule the next zooming step. This effectively continuously zooms while still accepting input events so that the zoom center point can be changed, and zooming can be stopped.