public class PZoomEventHandler extends PDragSequenceEventHandler
On a Mac with its single mouse button one may wish to change the standard right mouse button zooming behavior. This can be easily done with the PInputEventFilter. For example to zoom with button one and shift you would do this:
zoomEventHandler.getEventFilter().setAndMask(InputEvent.BUTTON1_MASK |
InputEvent.SHIFT_MASK);
Constructor and Description |
---|
PZoomEventHandler()
Creates a new zoom handler.
|
Modifier and Type | Method and Description |
---|---|
protected void |
dragActivityFirstStep(PInputEvent event)
Records the start point of the zoom.
|
protected void |
dragActivityStep(PInputEvent event)
Updates the current zoom periodically, regardless of whether the mouse
has moved recently.
|
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 |
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.
|
drag, dragActivityFinalStep, endDrag, getDragActivity, getMinDragStartDistance, getMousePressedCanvasPoint, isDragging, mouseDragged, mousePressed, mouseReleased, setIsDragging, setMinDragStartDistance, shouldStartDragInteraction, startDrag, startDragActivity, stopDragActivity
acceptsEvent, getEventFilter, keyboardFocusGained, keyboardFocusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseWheelRotated, mouseWheelRotatedByBlock, processEvent, setEventFilter
public double getMinScale()
public void setMinScale(double minScale)
minScale
is larger than the current scale.minScale
- the minimum scale, must not be negative.public double getMaxScale()
public void setMaxScale(double maxScale)
maxScale
is smaller than the current scale. Use
Double.MAX_VALUE to specify the largest possible scale.maxScale
- the maximum scale, must not be negative.protected void dragActivityFirstStep(PInputEvent event)
dragActivityFirstStep
in class PDragSequenceEventHandler
event
- event responsible for starting the zoom interactionprotected void dragActivityStep(PInputEvent event)
dragActivityStep
in class PDragSequenceEventHandler
event
- contains information about the current state of the mouseCopyright © 1995-2013 Piccolo2D. All Rights Reserved.