Search in sources :

Example 1 with ViewerSelectionEvent

use of maspack.render.ViewerSelectionEvent in project artisynth_core by artisynth.

the class GLMouseAdapter method checkForSelection.

private void checkForSelection(MouseEvent e) {
    int flags = getSelectionOperation(e);
    ViewerSelectionEvent selEvent = new ViewerSelectionEvent();
    selEvent.setModifiersEx(e.getModifiersEx());
    viewer.selectionEvent = selEvent;
    // delimits the pick region (with x, y at the center)
    double x, y, w, h;
    boolean ignoreDepthTest = false;
    Rectangle dragBox = viewer.getDragBox();
    if (dragBox != null) {
        x = dragBox.x + dragBox.width / 2.0;
        y = dragBox.y + dragBox.height / 2.0;
        w = dragBox.width;
        h = dragBox.height;
        flags |= ViewerSelectionEvent.DRAG;
        if (!visibleSelectionOnly) {
            // Normally true!
            ignoreDepthTest = true;
        }
    } else {
        x = e.getX();
        y = e.getY();
        if (viewer.getEllipticSelection()) {
            Vector2d csize = viewer.getEllipticCursorSize();
            w = 2 * csize.x;
            h = 2 * csize.y;
            flags |= ViewerSelectionEvent.DRAG;
        } else {
            w = 3.0;
            h = 3.0;
        }
        ignoreDepthTest = false;
    }
    viewer.setPick(x, y, w, h, ignoreDepthTest);
    selEvent.setFlags(flags);
// {
// GLSelectionEvent selEvent = new GLSelectionEvent();
// selEvent.myModifiersEx = e.getModifiersEx();
// selEvent.setMode(SelectionType.Clear);
// viewer.selectionEvent = selEvent;
// }
}
Also used : Vector2d(maspack.matrix.Vector2d) Rectangle(java.awt.Rectangle) ViewerSelectionEvent(maspack.render.ViewerSelectionEvent) Point(java.awt.Point)

Aggregations

Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 Vector2d (maspack.matrix.Vector2d)1 ViewerSelectionEvent (maspack.render.ViewerSelectionEvent)1