|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.event.MouseInputAdapter org.proteinshader.gui.listeners.CanvasMouseListener
public class CanvasMouseListener
Converts mouse movements across the canvas to image rotations or
camera movements.
On Mac OS X computers that might have only a single mouse button, the
single mouse button is the equivalent of the left button (button 1) on
a typical Windows or Linux mouse, while the combination of the
Macintosh Command key with the single mouse button is the equivalent
of the right mouse button (button 3). On mice that do not have a
middle button (button 2), the combination of the shift key and the
left button (button 1) is used.
IMAGE_ROTATE_XY:
Windows/Linux - left mouse click
Macintosh OS X - mouse click
vertical mouse drag - results in rotation about x-axis of protein.
horizontal mouse drag - results in rotation about y-axis of protein.
IMAGE_ROTATE_Z:
Windows/Linux - shift key and right mouse click
Macintosh OS X - command key, shift key, and mouse click.
horizontal mouse drag - results in rotation about z-axis of protein.
CAMERA_PAN_XY:
Windows/Linux - right mouse click.
Maintosh OS X - command key and mouse click.
vertical mouse drag - results in camera panning in y direction.
horizontal mouse drag - results in camera panning in x direction.
CAMERA_ZOOM_Z:
Windows/Linux - shift key and left mouse click (or middle mouse click).
Maintosh OS X - shift key and mouse click.
horizontal mouse drag - results in rotation about z-axis of protein.
Nested Class Summary | |
---|---|
static class |
CanvasMouseListener.Mode
The mode controls image rotation and camera movements. |
Field Summary | |
---|---|
static int |
B1_MASK
Abbreviated version of mouse button 1 mask for class InputEvent. |
static int |
B2_MASK
Abbreviated version of mouse button 2 mask for class InputEvent. |
static int |
B3_MASK
Abbreviated version of mouse button 3 mask for class InputEvent. |
static int |
CAMERA_XY_SCALE
The camera xy scale factor is used to slow down camera movement in the xy-plane. |
static int |
CAMERA_ZOOM_SCALE
The camera zoom factor is used to slow down camera movement in the z-axis (for mouse dragging). |
static int |
WHEEL_SCALE_FACTOR
When the mouse wheel is used for zooming, this scaling factory will determine how many angstroms the camera moves in or out for each wheel click. |
Constructor Summary | |
---|---|
CanvasMouseListener(Renderer renderer)
Constructs a CanvasMouseListener. |
Method Summary | |
---|---|
void |
mouseDragged(MouseEvent e)
Rotates the model and redraws the canvas in response to the mouse being dragged across the canvas. |
void |
mousePressed(MouseEvent e)
Remembers xy-coordinates where mouse was clicked. |
void |
mouseWheelMoved(MouseWheelEvent e)
Zooms the camera in or out based on the number of wheel clicks. |
void |
moveCameraZ(int deltaHeight)
Uses the mouse movement in the vertical direction to zoom the camera in or out. |
Methods inherited from class javax.swing.event.MouseInputAdapter |
---|
mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseReleased |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CAMERA_XY_SCALE
public static final int CAMERA_ZOOM_SCALE
public static final int WHEEL_SCALE_FACTOR
public static final int B1_MASK
public static final int B2_MASK
public static final int B3_MASK
Constructor Detail |
---|
public CanvasMouseListener(Renderer renderer)
renderer
- the Renderer for the canvas of the main GUI.Method Detail |
---|
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
mousePressed
in class MouseInputAdapter
e
- the mouse event triggered when a button is pressed.public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class MouseInputAdapter
e
- the mouse event.public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
public void moveCameraZ(int deltaHeight)
deltaHeight
- the mouse movement in the vertical direction.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |