Manipulators
A Manipulator is a kind of decorator that places grab-handles
on a figure so that it can be resized and otherwise manipulated.
The following diagram shows the main participants:
The manipulator, like any FigureDecorator, contains a single
specialized instance of Figure, which is its child figure,
and which is generally set by a SelectionRenderer.
In the case of manipulators, this figure is the one that is
being manipulated.
When a SelectionRenderer or other object calls the wrap() method
to wrap the child figure in the manipulator, the manipulator creates
some number of GrabHandle. To do so, it uses an instance of
GrabHandleFactory, thus allowing the kind of grab-handles created by
manipulators to be easily parameterized.
There are basic implementations of GrabHandle and GrabHandleFactory
to provide a useful default grab-handle.
Each grab-handle has a DragInteractor attached to it, which is
activated if it is accepted by a suitable MouseFilter. Both of these
last two objects can be set via the Manipulator interface. Each
GrabHandle is attached to a single Site, and the relocate() method of
GrabHandle is used to reposition the grab-handle at the location of
the Site.
There are two concrete subclasses of manipulator in the
basic canvas support: BoundsManipulator places grab-handles
on the corners and edges of the bounding box of a figure,
while PathManipulator places grab-handles on each vertex of
an arbitrary shape.
|