edu.umd.cs.jazz.event
Class ZSelectionMoveHandler
java.lang.Object
|
+--edu.umd.cs.jazz.event.ZFilteredEventHandler
|
+--edu.umd.cs.jazz.event.ZDragSequenceEventHandler
|
+--edu.umd.cs.jazz.event.ZSelectionMoveHandler
- All Implemented Interfaces:
- ZEventHandler
- public class ZSelectionMoveHandler
- extends ZDragSequenceEventHandler
ZSelectionMoveHandler is a selection handler for use with ZSelectionManager and ZSelectionMoveHandler
It allows the user to translate the current selection in two ways:
- Any item in the current selection may be dragged with the mouse. All selected items will be translated.
- The arrow keys may be used to apply a small translation (or "nudge") to the selected items.
It should be noted that this event handler may not have the desired effect if internal cameras are used. This cannot be fixed in a general purpose way for two reasons: the possibility of multiple representations and the possibility of multiple cameras viewing the same nodes. First, an internal camera is a normal visual component and as such can appear in multiple places in a jazz scenegraph. Consequently, if items in an internal camera are selected and the internal camera appears in multiple places, moving these items becomes arbitrary (ie. for which representation do they move appropriately). Second, if two distinct cameras are viewing the same set of selected nodes it is again an arbitrary decision as for which camera the nodes are moved appropriately. As a result, in the case when the event handler is globally active and internal or multiple cameras appear, the nodes are moved first according to the most recently interacted camera or, if none has been interacted, according to the top camera (of the ZCanvas).
- Author:
- Antony Courtney, Yale University
- , Lance Good, University of Maryland , Benjamin Bederson, University of Maryland , Jesse Grosjean, University of Maryland
- See Also:
-
ZSelectionManager
, ZCompositeSelectionHandler
, ZSelectionModifyHandler
, ZSelectionDeleteHandler
, ZSelectionScaleHandler
Method Summary |
protected void |
dragInScreenCoords(ZMouseEvent e, java.awt.geom.Dimension2D aScreenDelta)
Drag all the selected visible in the interaction current camera by the given screen delta. |
protected void |
dragSelectionBy(java.awt.geom.Dimension2D aScreenDelta)
Drag selection implementation used for both key and mouse drags. |
protected void |
filteredKeyPressed(java.awt.event.KeyEvent e)
When an arrow key is pressed move the selection one pixel in the direction of the arrow. |
ZMouseFilter |
getMouseFilter()
Moving works with BUTTON1 by default. |
protected void |
startDrag(ZMouseEvent e)
At the start of a drag sequence see if we are over a node, or over the camera background. |
Methods inherited from class edu.umd.cs.jazz.event.ZDragSequenceEventHandler |
drag, endDrag, filteredMouseDragged, filteredMousePressed, filteredMouseReleased, getCurrentScreenDelta, getCurrentScreenPoint, getDragStartScreenPoint, getMinDragStartDistance, getMousePressedScreenPoint, getPreviousScreenPoint, isDragging, setIsDragging, setMinDragStartDistance, shouldStartDragInteraction |
Methods inherited from class edu.umd.cs.jazz.event.ZFilteredEventHandler |
filteredKeyReleased, filteredKeyTyped, filteredMouseClicked, filteredMouseEntered, filteredMouseExited, filteredMouseMoved, getCurrentFilteredMouseEvent, getCurrentSelection, getFilteredEventDispatcher, getFilteredKeyEventSource, getFilteredMouseEventSource, getInteractionCamera, getTopCamera, isActive, setActive, setFilteredKeyEventSource, setFilteredMouseEventSource, setMouseFilter, wantsKeyEvents, wantsMouseEvents, wantsMouseMotionEvents |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZSelectionMoveHandler
public ZSelectionMoveHandler(ZSceneGraphObject aFilteredMouseEventSource,
ZCanvas aFilteredKeyEventSouce)
-
Construct a new ZSelectionMoveHandler.
- Parameters:
-
aFilteredMouseEventSource
- the source for filtered ZMouseEvents and ZMouseMotionEvents. See the ZFilteredEventHandler class comment to customize this behavior.
-
aFilteredKeyEventSouce
- the source for filtered KeyEvents. See the ZFilteredEventHandler class comment to customize this behavior.
getMouseFilter
public ZMouseFilter getMouseFilter()
-
Moving works with BUTTON1 by default.
-
- Overrides:
-
getMouseFilter
in class ZFilteredEventHandler
-
- Returns:
- the filter that is currently in effect.
filteredKeyPressed
protected void filteredKeyPressed(java.awt.event.KeyEvent e)
-
When an arrow key is pressed move the selection one pixel in the direction of the arrow.
-
- Overrides:
-
filteredKeyPressed
in class ZFilteredEventHandler
-
- Parameters:
-
e
- the filtered key pressed event accepted by the event filter.
startDrag
protected void startDrag(ZMouseEvent e)
-
At the start of a drag sequence see if we are over a node, or over the camera background. If we are over a node then continue with the drag sequence, else reject all events until we get the next mousePressed event.
-
- Overrides:
-
startDrag
in class ZDragSequenceEventHandler
-
- Parameters:
-
e
- the event starting the drag sequence.
dragInScreenCoords
protected void dragInScreenCoords(ZMouseEvent e,
java.awt.geom.Dimension2D aScreenDelta)
-
Drag all the selected visible in the interaction current camera by the given screen delta.
-
- Overrides:
-
dragInScreenCoords
in class ZDragSequenceEventHandler
-
- Parameters:
-
e
- the event causing the drag.
-
aScreenDelta
- the change in mouse position between the current and last filtered mouse events.
dragSelectionBy
protected void dragSelectionBy(java.awt.geom.Dimension2D aScreenDelta)
-
Drag selection implementation used for both key and mouse drags.
-
Copyright � 2003 by University of Maryland, College Park, MD 20742, USA All rights reserved.