vmm3d.core
Class BasicMouseTask2D
- java.lang.Object
-
- vmm3d.core.MouseTask
-
- vmm3d.core.BasicMouseTask2D
-
public class BasicMouseTask2D extends MouseTask
A BasicMouseTask2D is a MouseTask that allows the user to drag and zoom the 2D window that is used to draw the Exhibit in a display. Dragging is done with the left mouse button. Zooming is done by dragging up/down with the middle mouse button (or holding down a shift or alt or option key). When draggin with the left mouse button, the user can switch between dragging the exhibit and zooming it by pressing and releasing the shift key.The user can also use the right mouse key (or hold down the control or command key) to draw a rectangle; the rectangle can be moved while dragging by holding down the shift key. The View is then zoomed into that rectangle. The shape of the rectangle is contrained to have the same aspect ration as the display.
All the methods in this class are called by a Display in response to user actions. None of them are meant to be called directly.
-
-
Constructor Summary
Constructors Constructor and Description BasicMouseTask2D()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleandoMouseDown(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Decides what type of operation to perform in response to a user's mouse click, and initiates that operation.voiddoMouseDrag(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Continue processing a drag operation.voiddoMouseUp(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Finish processing a drag operation.voiddrawWhileDragging(org.freehep.graphics2d.VectorGraphics g, Display display, View view, int width, int height)When the Display is repainted during a drag operation, this method will be called after the Exhibit is drawn, to give the MouseTask a chance to draw some extra stuff on top of the Exhibit.java.awt.CursorgetCursorForDragging(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 vmm3d.core.MouseTask
finish, getCursor, getStatusText, start, wantsMoreClicks
-
-
-
-
Method Detail
-
doMouseDown
public boolean doMouseDown(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Decides what type of operation to perform in response to a user's mouse click, and initiates that operation. This method is called by a Display when the user clicks on the Display; it is not meant to be called directly.- Specified by:
doMouseDownin classMouseTask- 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).- Returns:
- returns true to tell the Display that the drag operation should continue, unless there is no Exhibit currently installed in the display.
-
doMouseDrag
public void doMouseDrag(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Continue processing a drag operation.- Overrides:
doMouseDragin classMouseTask- 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 processing a drag operation.- Overrides:
doMouseUpin classMouseTask- 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.- Overrides:
getCursorForDraggingin classMouseTask- See Also:
MouseTask.doMouseDown(MouseEvent, Display, View, int, int),MouseTask.getCursor(Display, View)
-
drawWhileDragging
public void drawWhileDragging(org.freehep.graphics2d.VectorGraphics g, Display display, View view, int width, int height)When the Display is repainted during a drag operation, this method will be called after the Exhibit is drawn, to give the MouseTask a chance to draw some extra stuff on top of the Exhibit. In this class, it draws nothing unless the operation that is being performed is to draw a rectangle for zooming; if that is the operation, then the rectangle is drawn in red.- Overrides:
drawWhileDraggingin classMouseTask
-
-
DMelt 3.0 © DataMelt by jWork.ORG