SoTabPlaneDragger – object you can translate or scale within a plane by dragging with the mouse
SoTabPlaneDragger is a dragger which allows the user to interactively translate and scale in a plane. It looks like a square white outline with smaller green squares (or
tabs) set in the corners and along the center of each
edge. Dragging a
corner tab scales the dragger in 2D by scaling about the opposite corner. Dragging an
edge tab performs 1D scaling about the opposite edge. The rest of the dragger is invisible but pickable; selecting it
initiates translation within the plane.
The dragger tries to keep the small tabs a constant size in screen space. Every time a drag begins or ends, the size is recalculated based on the viewing and modeling
matrix.
When dragging the translator part, press the
<Shift> key and you can constrain motion to either the local
x axis or the
y axis. The direction is determined by your initial mouse gesture after pressing the key.
Releasing the key removes the constraint.
When the translator part drags, the dragger updates its
translation field. The various scaling parts cause changes to both the
scaleFactor and
translation field, since scaling about a point
other than the center adds translation to the center of the dragger. If you set the field, the dragger will move accordingly. You can also connect fields of other nodes or engines from this one to make
them follow the dragger's motion.
You can not change the shape used to draw the tabs. This part is kept privately and may not be changed; the coordinates for the tabs are edited during
adjustScaleTabSize().
The
SoTabPlaneDragger class
does contain three other parts you can change:
tabPlaneTranslator,
tabPlaneScaleTabMaterial and
tabPlaneScaleTabHints.
Each of these is set by default from a resource described in the Dragger Resources section of the online reference page for this class. You
can change the parts in any instance of this dragger using
setPart().
You can make your program use different default resources for the parts by copying the file
/usr/share/data/draggerDefaults/tabPlaneDragger.iv into your own directory, editing the file, and
then setting the environment variable
SO_DRAGGER_DIR to be a path to that directory.