public abstract class PDragSequenceEventHandler extends PBasicInputEventHandler
PDragSequenceEventHandler should be subclassed by a concrete event handler that implements a particular interaction. See PPanEventHandler, PZoomEventHandler, and PDragEventHandler for examples.
Constructor and Description |
---|
PDragSequenceEventHandler()
Constructs a drag sequence event handler instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
drag(PInputEvent event)
Subclasses should override this method to get notified of the drag events
in a drag sequence.
|
protected void |
dragActivityFinalStep(PInputEvent aEvent)
Subclasses should override this method to get notified when the drag
activity stops stepping.
|
protected void |
dragActivityFirstStep(PInputEvent event)
Subclasses override this method to get notified when the drag activity
starts stepping.
|
protected void |
dragActivityStep(PInputEvent event)
During a drag sequence an activity is scheduled that runs continuously
while the drag sequence is active.
|
protected void |
endDrag(PInputEvent event)
Subclasses should override this method to get notified of the end event
in a drag sequence.
|
protected PActivity |
getDragActivity()
Returns the scheduled activity that's updating the scene as a result to
the current drag activity (if any).
|
double |
getMinDragStartDistance()
Returns the minimum distance (in screen coordinates) before a pressed
mouse movement is registered as a drag event.
|
Point2D |
getMousePressedCanvasPoint()
Return the point in canvas coordinates where the mouse was last pressed.
|
boolean |
isDragging()
Returns true if this event handler is in the process of handling a drag.
|
void |
mouseDragged(PInputEvent event)
Subclasses should not override this method, instead they should
override the appropriate drag method.
|
void |
mousePressed(PInputEvent event)
Subclasses should not override this method, instead they should
override the appropriate drag callbacks.
|
void |
mouseReleased(PInputEvent event)
Subclasses should not override this method, instead they should
override the appropriate drag method.
|
void |
setIsDragging(boolean isDragging)
Used to inform this handler that it is in the process of handling a drag.
|
void |
setMinDragStartDistance(double minDistance)
Set the minimum distance that the mouse should be dragged (in screen
coordinates) before a new drag sequence is initiate.
|
protected boolean |
shouldStartDragInteraction(PInputEvent event)
Returns true if the provided event represents a valid start for a drag
sequence.
|
protected void |
startDrag(PInputEvent event)
Subclasses should override this method to get notified of the start of a
new drag sequence.
|
protected void |
startDragActivity(PInputEvent event)
Schedules the "infinite" drag activity so that auto-panning and zooming
will continue to update the scene even if there are no further drag
events fired.
|
protected void |
stopDragActivity(PInputEvent event)
Stops the activity responsible for updating the scene.
|
acceptsEvent, getEventFilter, keyboardFocusGained, keyboardFocusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseWheelRotated, mouseWheelRotatedByBlock, processEvent, setEventFilter
public PDragSequenceEventHandler()
public boolean isDragging()
public void setIsDragging(boolean isDragging)
isDragging
- true if handler is processing a dragpublic double getMinDragStartDistance()
public void setMinDragStartDistance(double minDistance)
minDistance
- in screen coordinatespublic Point2D getMousePressedCanvasPoint()
protected void startDrag(PInputEvent event)
event
- event that started the drag sequenceprotected void drag(PInputEvent event)
event
- event that caused the dragprotected void endDrag(PInputEvent event)
event
- event that ended the drag sequenceprotected boolean shouldStartDragInteraction(PInputEvent event)
event
- event being testedprotected PActivity getDragActivity()
protected void startDragActivity(PInputEvent event)
event
- the event that's responsible for the start of the activityprotected void stopDragActivity(PInputEvent event)
event
- The event responsible for stopping the drag activityprotected void dragActivityFirstStep(PInputEvent event)
event
- the event responsible for the first step in the drag
activityprotected void dragActivityStep(PInputEvent event)
event
- the event encapsulating the callback context for the
activity stepprotected void dragActivityFinalStep(PInputEvent aEvent)
aEvent
- the event responsible for ending the activitypublic void mousePressed(PInputEvent event)
mousePressed
in class PBasicInputEventHandler
event
- The event to be queried about the details of the mouse presspublic void mouseDragged(PInputEvent event)
mouseDragged
in class PBasicInputEventHandler
event
- The event to be queried about the details of the mouse presspublic void mouseReleased(PInputEvent event)
mouseReleased
in class PBasicInputEventHandler
event
- The event to be queried about the details of the mouse releaseCopyright © 1995-2013 Piccolo2D. All Rights Reserved.