Several of the interaction methods previously presented take a
modifier as one of their arguments. This section elaborates on
modifiers, and presents the constraints they impose on the
interactions.
A keyboard modifier is a 'pseudo-key' on the keyboard,
that when pressed (in the following called ON) during a normal key press, will modify the meaning
of the action. Usually there are at least three modifiers on a
keyboard: The Shift key, the Control key, and the Meta key. On the
keyboard, the Meta
key is often labelled something other than Meta: On some Hewlett
Packard keyboards it is labelled Extend Char, on some Sun workstation
keyboards there are two Meta keys, labelled Left and Right,
respectively, on some Sun SPARC keyboards it is labelled Alt, on most
Macintosh keyboards it is labelled Alt, etc...
As mentioned a modifier key is not a normal key, e.g. it will not
invoke the onKeyDown virtual of a Canvas eventhandler, if the modifier
key is pressed alone. Instead the modifier changes (modifies) the
meaning of the normal keys, if the modifier is held down when the
normal key is pressed.
-
Shift
-
makes the character typed become upper case. Technically the 5'th bit of the 7
or 8 bit a character is represented by, is set.
-
Control
-
clears the 7'th bit of the numerical value of the character.
-
Me ta
-
sets the 8'th bit of the numerical value of the character.
Modifiers can also be used during interaction with the mouse. This
does not change anything directly, but is usually used to modify the
feedback during the interaction. This is why the onButtonDown virtual
of a Canvas eventhandler contains some booleans, indicating if the
corresponding modifier was ON when the mouse button was pressed. E.g.,
if shiftmodified is true, it means that the shift modifier was ON when
the mouse button was pressed.
InteractiveCreateShape, InteractiveReshape, and InteractiveMove in
the Canvas pattern, and the corresponding methods of graphical objects
and shapes all have an enter parameter called theModifier, that is
used to specify what modifier to use to make the interaction
constrained. Thus if ShiftModifier is used, it means that if holding
down the Shift key during the interaction, the interaction will be
constrained in some way, see below. A pseudo modifier called
NoModifier has been defined to specify that all modifiers should be
ignored, i.e., the interaction should not be constrainable.
Bifrost contains a small graphical editor, bdraw,
residing in the directory
~beta/bifrost/bdraw
.
Compiling and running this allows, the interaction forms of the
different graphical objects, and the constraints the modifiers impose
on them can be tried in practice. In bdraw, Shift is used as the
modifier.
Here is a short overview of the interaction forms when creating,
moving and reshaping the different graphical objects:
- InteractiveCreate:
-
- Rect:
- The feedback is a 'rubber rectangle', defined by the start point and the position of the mouse. If theModifier is ON, the Rect is constrained to be a square. The interaction stops when the mouse is clicked.
- Ellipse:
- The feedback is a 'rubber ellipse' defined by the start
point and the mouse position. If theModifier is ON, the Ellipse is
constrained to be a circle. The interaction stops when the mouse is
clicked.
- GraphicalObject:
- Control points are added by clicking the left mouse button. The
feedback is a 'rubber line' from the previous control point
added to the mouse position, and another line from the start point to
the mouse position. If theModifier is ON, SplineSegment control points
are added, otherwise LineSegment. The interaction stops when the right
mouse button is clicked. On machines with only one mouse button the
interaction is stopped by double-clicking the mouse button.
- PieSlice:
- The interaction has two phases: First a rectangle with an
inscribed ellipse is laid out, to define what ellipse the PieSlice
should be a slice of. This phase is much like InteractiveCreate of an
Ellipse. The second phase is determining the two angles defining the
slice. This is done using 'rubber lines' from the center to
the periphery of the ellipse, in direction towards the mouse
position. Each of the two angles are set when the mouse is
clicked. When the last angle is determined, the interaction stops. If
theModifier is ON, in the first phase, the ellipse is constrained to
be a circle. In the second phase, angles are constrained to be
multiples of 45 degrees.
- GraphicText:
- The interaction is done via the keyboard. Characters are typed in
the normal way, and typing <ESCAPE> ot clicking the mouse will
end the interaction. During the interaction, the end of the text being
typed is marked with a vertical bar ('insertion point').
- Line:
- The feedback is a 'rubber line' from the start point to the mouse position. If theModifier is ON, the angles of the rubber line is constrained to multiples of 45 degrees. The interaction is stopped by clicking the mouse.
- MultiLine:
- Control points are set using the left mouse button. During this
phase, the interaction is a 'rubber line' from the previous
control point to the mouse position. The interaction is stopped by
clicking the right mouse button. If theModifier is ON, the angles of
the rubber line is constrained to multiples of 45 degrees. On machines
with only one mouse button the interaction is stopped by
double-clicking the mouse button.
- Arc:
- The interaction is like InteractiveCreate for PieSlice, except
that 'moving points' on the periphery are used instead of
'rubber lines' from the centre to the periphery during
specification of angles in the second phase.
- InteractiveMove:
-
- All objects:
- The outline of the graphical object follows the movements of the mouse. If theModifier is held down, the movement is constrained to horizontal and vertical directions. The interaction stops when the mouse button is released.
- InteractiveReshape:
-
- All objects:
- For all kinds of graphical objects
[10]
InteractiveReshape is initiated by
grabbing a control point and dragging it around, thus causing the
shape to be altered. In GraphicalObject, the theModifier argument of
InteractiveReshape is currently ignored, but for the other object
kinds, if theModifier is ON, the interaction is constrained in the
same way as during InteractiveCreate. When reshaping a PieSlice or an
Arc, grabbing one of the 'corners' will change either the
horizontal radius or the vertical radius of the object, whereas
grabbing one of the two control points on the periphery defining the
angles will change the corresponding angle.
[10] Except for GraphicText, for which InteractiveReshape is not yet implemented
The Bifrost Graphics System - Reference Manual |
© 1991-2004 Mjølner Informatics |
[Modified: Monday October 23rd 2000 at 21:21]
|