diva.canvas.interactor
Class BoundedDragInteractor
java.lang.Object
diva.canvas.interactor.AbstractInteractor
diva.canvas.interactor.DragInteractor
diva.canvas.interactor.BoundedDragInteractor
- All Implemented Interfaces:
- LayerListener, LayerMotionListener, Interactor, java.util.EventListener
public class BoundedDragInteractor
- extends DragInteractor
An interactor that drags its target only within a given
rectangular region. An instance of this class sets itself up so
that the dragged figures or items always remain within the given
region. To do so, it creates an instance of BoundsConstraint that
it attaches to itself, and overrides the setup() method to
initialize the constraint according to the size of the target.
This interactor is intended more as an example of how to
produce a customized drag-interactor than anything else.
- Version:
- $Id: BoundedDragInteractor.java 38798 2005-07-08 20:00:01Z cxh $
- Author:
- John Reekie
Constructor Summary |
BoundedDragInteractor(java.awt.geom.Rectangle2D bounds)
Create an instance that keeps figures inside the given regio |
Method Summary |
void |
setup(LayerEvent e)
Adjust the bounds so that the bounding-box of the target stays
within the region. |
Methods inherited from class diva.canvas.interactor.DragInteractor |
addLayerListener, appendConstraint, constrainPoint, fireLayerEvent, getSelectiveEnabled, getTargetArray, getX, getY, mouseDragged, mousePressed, mouseReleased, prependConstraint, removeLayerListener, setSelectiveEnabled, setTargetArray, targets, translate |
Methods inherited from class diva.canvas.interactor.AbstractInteractor |
accept, getMouseFilter, isConsuming, isEnabled, isMotionEnabled, mouseClicked, mouseEntered, mouseExited, mouseMoved, setConsuming, setEnabled, setMotionEnabled, setMouseFilter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_bounds
private java.awt.geom.Rectangle2D _bounds
- The bounds
_constraint
private BoundsConstraint _constraint
- The bounds constraint
BoundedDragInteractor
public BoundedDragInteractor(java.awt.geom.Rectangle2D bounds)
- Create an instance that keeps figures inside the given regio
setup
public void setup(LayerEvent e)
- Adjust the bounds so that the bounding-box of the target stays
within the region.
- Overrides:
setup
in class DragInteractor