Java Code Examples for com.jogamp.newt.event.MouseEvent#getPointerId()

The following examples show how to use com.jogamp.newt.event.MouseEvent#getPointerId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SceneUIController.java    From jogl-samples with MIT License 5 votes vote down vote up
@Override
public void mousePressed(final MouseEvent e) {
    if( -1 == lId || e.getPointerId(0) == lId ) {
        lx = e.getX();
        ly = e.getY();
        lId = e.getPointerId(0);
    }
    // flip to GL window coordinates
    final int glWinX = e.getX();
    final int glWinY = viewport[3] - e.getY() - 1;
    dispatchMouseEvent(e, glWinX, glWinY);
}
 
Example 2
Source File: SceneUIController.java    From jogl-samples with MIT License 5 votes vote down vote up
@Override
public void mouseDragged(final MouseEvent e) {
    // drag activeShape, if no gesture-activity, only on 1st pointer
    if( null != activeShape && !pinchToZoomGesture.isWithinGesture() && e.getPointerId(0) == lId ) {
        lx = e.getX();
        ly = e.getY();

        // dragged .. delegate to active shape!
        // flip to GL window coordinates
        final int glWinX = lx;
        final int glWinY = viewport[3] - ly - 1;
        dispatchMouseEventForShape(activeShape, e, glWinX, glWinY);
    }
}
 
Example 3
Source File: SceneUIController.java    From jogl-samples with MIT License 5 votes vote down vote up
@Override
public void mouseMoved(final MouseEvent e) {
    if( -1 == lId || e.getPointerId(0) == lId ) {
        lx = e.getX();
        ly = e.getY();
        lId = e.getPointerId(0);
    }
}