edu.umd.cfar.lamp.viper.gui.canvas
Class ScrollWheelZoomHandler

java.lang.Object
  extended byedu.umd.cs.piccolo.event.PBasicInputEventHandler
      extended byedu.umd.cfar.lamp.viper.gui.canvas.ScrollWheelZoomHandler
All Implemented Interfaces:
java.util.EventListener, edu.umd.cs.piccolo.event.PInputEventListener

public class ScrollWheelZoomHandler
extends edu.umd.cs.piccolo.event.PBasicInputEventHandler

Author:
clin Code is a combination of PZoomEventHandler (which uses dragging to control zooming) and ChronicleViewer which uses scrollwheel to control zooming, and makes scrollwheel control zooming. Event processing is done by mouseWheelRotated. This is added as an event handler to ViperDataCanvas (as an InputEventListener), but can be used elsewhere.

Constructor Summary
ScrollWheelZoomHandler()
           
 
Method Summary
 double getMaxScale()
          Returns the maximum view magnification factor that this event handler is bound by.
 double getMinScale()
          Returns the minimum view magnification factor that this event handler is bound by.
 void mouseWheelRotated(edu.umd.cs.piccolo.event.PInputEvent event)
          Wheel rotation up zooms in.
protected  java.lang.String paramString()
          Returns a string representing the state of this node.
 void setMaxScale(double maxScale)
          Sets the maximum view magnification factor that this event handler is bound by.
 void setMinScale(double minScale)
          Sets the minimum view magnification factor that this event handler is bound by.
 
Methods inherited from class edu.umd.cs.piccolo.event.PBasicInputEventHandler
acceptsEvent, getEventFilter, keyboardFocusGained, keyboardFocusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelRotatedByBlock, processEvent, setEventFilter, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScrollWheelZoomHandler

public ScrollWheelZoomHandler()
Method Detail

mouseWheelRotated

public void mouseWheelRotated(edu.umd.cs.piccolo.event.PInputEvent event)
Wheel rotation up zooms in. Wheel rotation down zooms out


getMinScale

public double getMinScale()
Returns the minimum view magnification factor that this event handler is bound by. The default is 0.

Returns:
the minimum camera view scale

setMinScale

public void setMinScale(double minScale)
Sets the minimum view magnification factor that this event handler is bound by. The camera is left at its current scale even if minScale is larger than the current scale.

Parameters:
minScale - the minimum scale, must not be negative.

getMaxScale

public double getMaxScale()
Returns the maximum view magnification factor that this event handler is bound by. The default is Double.MAX_VALUE.

Returns:
the maximum camera view scale

setMaxScale

public void setMaxScale(double maxScale)
Sets the maximum view magnification factor that this event handler is bound by. The camera is left at its current scale even if maxScale is smaller than the current scale. Use Double.MAX_VALUE to specify the largest possible scale.

Parameters:
maxScale - the maximum scale, must not be negative.

paramString

protected java.lang.String paramString()
Returns a string representing the state of this node. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Returns:
a string representation of this node's state