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

The following examples show how to use com.jogamp.newt.event.MouseEvent#isMetaDown() . 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: MouseControl.java    From clearvolume with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Interface method implementation
 * 
 * @see com.jogamp.newt.event.MouseAdapter#mouseWheelMoved(com.jogamp.newt.event.MouseEvent)
 */
@Override
public void mouseWheelMoved(final MouseEvent pMouseEvent)
{
  if (mRenderer.notifyEyeRayListeners(mRenderer, pMouseEvent))
    return;

  final float[] lWheelRotation = pMouseEvent.getRotation();

  double lZoomWheelFactor = 0.0125f * mMouseWheelFactor;

  if (pMouseEvent.isMetaDown())
  {
    mRenderer.addFOV(lWheelRotation[1] * lZoomWheelFactor);
  }
  else
  {
    lZoomWheelFactor /= mRenderer.getFOV();
    mRenderer.addTranslationZ(lWheelRotation[1] * lZoomWheelFactor);
  }

  setSavedMousePosition(pMouseEvent);

  mRenderer.notifyChangeOfVolumeRenderingParameters();

}
 
Example 2
Source File: MouseControl.java    From clearvolume with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void mousePressed(MouseEvent pMouseEvent)
{
  if (mRenderer.notifyEyeRayListeners(mRenderer, pMouseEvent))
    return;

  if (!pMouseEvent.isMetaDown() && !pMouseEvent.isShiftDown()
      && !pMouseEvent.isControlDown()
      && pMouseEvent.isButtonDown(1))
  {
    final float lMouseX = pMouseEvent.getX();
    final float lMouseY = pMouseEvent.getY();
    mArcBall.setBounds(mRenderer.getViewportWidth(),
                       mRenderer.getViewportHeight());
    mArcBall.setCurrent(mRenderer.getQuaternion());
    mArcBall.click(lMouseX, lMouseY);
  }

  mRenderer.getAdaptiveLODController()
           .notifyUserInteractionInProgress();

}
 
Example 3
Source File: MouseControl.java    From clearvolume with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void handleMoveLight(final MouseEvent pMouseEvent)
{

  if (!mMoveLightMode
      && mRenderer.getRenderAlgorithm(mRenderer.getCurrentRenderLayerIndex()) == RenderAlgorithm.IsoSurface
      && !pMouseEvent.isMetaDown()
      && !pMouseEvent.isShiftDown()
      && !pMouseEvent.isControlDown()
      && pMouseEvent.isAltDown()
      && !pMouseEvent.isAltGraphDown()
      && !pMouseEvent.isButtonDown(1))
  {
    moveLight(pMouseEvent);
  }
}
 
Example 4
Source File: MouseControl.java    From clearvolume with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void handleArcBall(final MouseEvent pMouseEvent)
{
  if (!pMouseEvent.isMetaDown() && !pMouseEvent.isShiftDown()
      && !pMouseEvent.isAltDown()
      && !pMouseEvent.isControlDown()
      && pMouseEvent.isButtonDown(1))
  {
    final float lMouseX = pMouseEvent.getX();
    final float lMouseY = pMouseEvent.getY();
    mArcBall.setBounds(mRenderer.getViewportWidth(),
                       mRenderer.getViewportHeight());
    mRenderer.setQuaternion(mArcBall.drag(lMouseX, lMouseY));

  }
}
 
Example 5
Source File: MouseControl.java    From clearvolume with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void handleTranslation(final MouseEvent pMouseEvent)
{
  final int dx = pMouseEvent.getX() - mSavedMouseX;
  final int dy = pMouseEvent.getY() - mSavedMouseY;

  // If the right button is held down, translate the object
  if (!pMouseEvent.isMetaDown() && !pMouseEvent.isControlDown()
      && (pMouseEvent.isButtonDown(3)))
  {

    mRenderer.addTranslationX(dx / 100.0f);
    mRenderer.addTranslationY(-dy / 100.0f);
  }
  setSavedMousePosition(pMouseEvent);
}
 
Example 6
Source File: MouseControl.java    From clearvolume with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Sets the transfer function range.
 * 
 * @param pMouseEvent
 *          mouse event
 */
public void handleAlphaBlending(final MouseEvent pMouseEvent)
{
  if (mRenderer.getRenderAlgorithm(mRenderer.getCurrentRenderLayerIndex()) == RenderAlgorithm.MaxProjection
      && !pMouseEvent.isMetaDown()
      && !pMouseEvent.isShiftDown()
      && !pMouseEvent.isControlDown()
      && pMouseEvent.isAltDown()
      && !pMouseEvent.isAltGraphDown()
      && pMouseEvent.isButtonDown(1))
  {
    final double lWidth = mRenderer.getViewportWidth();
    final double nx = (pMouseEvent.getX()) / lWidth;

    final double lAlpha = 16 * pow(nx,2);

    mRenderer.setAlphaBlending(mRenderer.getCurrentRenderLayerIndex(),
                               lAlpha);
    // System.out.println(lAlpha);
  }

  /*
  System.out.println("_____________________________________");
  System.out.println("isAltDown=" + pMouseEvent.isAltDown());
  System.out.println("isAltGraphDown="
                     + pMouseEvent.isAltGraphDown());
  System.out.println("isControlDown="
                     + pMouseEvent.isControlDown());
  System.out.println("isMetaDown=" + pMouseEvent.isMetaDown());
  System.out.println("isShiftDown=" + pMouseEvent.isShiftDown());
  /**/

}