BasicMouseTask2D
vmm3d.core

Class BasicMouseTask2D



  • public class BasicMouseTask2Dextends 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 Detail

      • BasicMouseTask2D

        public BasicMouseTask2D()
    • Method Detail

      • doMouseDown

        public boolean doMouseDown(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:
        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).
        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(MouseEvent evt,               Display display,               View view,               int width,               int height)
        Continue processing a drag operation.
        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(MouseEvent evt,             Display display,             View view,             int width,             int height)
        Finish processing a drag operation.
        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).
      • 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:
        drawWhileDragging in class MouseTask

SCaVis 2.1 © jWork.ORG