vmm.core3D
Class BasicMouseTask3D

java.lang.Object
  extended by vmm.core.MouseTask
      extended by vmm.core3D.BasicMouseTask3D

public class BasicMouseTask3D
extends MouseTask

A MouseTask that is designed to handle the most common cases of interaction with a three-dimensional Exhibit. Clicking and dragging with the left mouse button on a 3D Exhibit will do trackball-style rotation of the Exhibit. Using the middle mouse button, or the left mouse button with the Shift or ALT/Option key, will zoom the Exhibit as the mouse is dragged up and down. Using the right mouse button, or the left mouse button with the Control or Meta/Command key, will drag the Exhibit.

"Dragging" the exhibit has a special meaning when the exhibit is displayed in dual, sterographic mode. In that case, dragging the mouse horizontally will slide the two views of the exhibit closer together and farther apart. This is to allow the user to adjust the distance to make it easier to fuse the two views into one 3D view.


Constructor Summary
BasicMouseTask3D()
           
 
Method Summary
 boolean doMouseDown(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)
          Decides which operation to perform, if any.
 void doMouseDrag(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)
          Continue an operation that was begun in the doMouseDown method.
 void doMouseUp(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)
          Finish an operation that was begun in the doMouseDown method.
 java.awt.Cursor getCursorForDragging(java.awt.event.MouseEvent mouseDownEvent, Display display, View view)
          Returns the cursor that the Display should use during a drag operation.
 
Methods inherited from class vmm.core.MouseTask
drawWhileDragging, finish, getCursor, getStatusText, start, wantsMoreClicks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMouseTask3D

public BasicMouseTask3D()
Method Detail

doMouseDown

public boolean doMouseDown(java.awt.event.MouseEvent evt,
                           Display display,
                           View view,
                           int width,
                           int height)
Decides which operation to perform, if any. For stereographic views, a ZOOM or ROTATE operation is begun only if the mouse click is actually inside one of the two view rectangles.

Specified by:
doMouseDown in class MouseTask
Parameters:
evt - The mouse-down event, except that the x and y coordinates have been translated so that the top left corner of the View is at coordinates (0,0).
width - The width the drawing area (not including any insets).
height - The height the drawing area (not including any insets).

doMouseDrag

public void doMouseDrag(java.awt.event.MouseEvent evt,
                        Display display,
                        View view,
                        int width,
                        int height)
Continue an operation that was begun in the doMouseDown method. The user can change the operation in the middle of a mouse drag by pressing and releasing modifier keys.

Overrides:
doMouseDrag in class MouseTask
Parameters:
evt - The mouse-dragged event, except that the x and y coordinates have been translated by display.getInsets().left and display.getInsets().top to account for any border that has been applied to the display.
width - The width the drawing area (not including any insets).
height - The height the drawing area (not including any insets).

doMouseUp

public void doMouseUp(java.awt.event.MouseEvent evt,
                      Display display,
                      View view,
                      int width,
                      int height)
Finish an operation that was begun in the doMouseDown method. If the operation is ROTATE and the user was still moving the mouse when the mouse button was released, then an animation is installed in the Display that will continue the rotation indefinitely.

Overrides:
doMouseUp in class MouseTask
Parameters:
evt - The mouse-up event, except that the x and y coordinates have been translated by display.getInsets().left and display.getInsets().top to account for any border that has been applied to the display.
width - The width the drawing area (not including any insets).
height - The height the drawing area (not including any insets).

getCursorForDragging

public java.awt.Cursor getCursorForDragging(java.awt.event.MouseEvent mouseDownEvent,
                                            Display display,
                                            View view)
Returns the cursor that the Display should use during a drag operation. The cursor that is returned depends on which operation is being performed with the mouse. TODO: Use a better cursor for ZOOMing.

Overrides:
getCursorForDragging in class MouseTask
See Also:
MouseTask.doMouseDown(MouseEvent, Display, View, int, int), MouseTask.getCursor(Display, View)