当前位置: 首页>>代码示例>>Java>>正文


Java MouseEvent.getRotation方法代码示例

本文整理汇总了Java中com.jogamp.newt.event.MouseEvent.getRotation方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getRotation方法的具体用法?Java MouseEvent.getRotation怎么用?Java MouseEvent.getRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.newt.event.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.getRotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mouseWheelMoved

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseWheelMoved(MouseEvent e) {
    Vec2d screenAnchor = new Vec2d(e.getX() / (double) view.getSize().x, e.getY() / (double) view.getSize().y);
    Vec2d worldAnchor = Rect2d.project(new Rect2d(1, 0, 0, 1), view.getViewportBounds(), screenAnchor);

    // set zoom
    double zoom = view.getZoomLevel();
    zoom += e.getRotation()[0] * e.getRotationScale() * zoomFactor;
    zoom += e.getRotation()[1] * e.getRotationScale() * zoomFactor;
    view.setZoomLevel(zoom);

    // update position
    Vec2d worldAtAnchorNow = Rect2d.project(new Rect2d(1, 0, 0, 1), view.getViewportBounds(), screenAnchor);
    Vec2d delta = Vec2d.sub(worldAtAnchorNow, worldAnchor);

    Vec3d vpos = view.getPosition();
    view.setPosition(vpos.x + delta.x, vpos.y + delta.y);
}
 
开发者ID:sgs-us,项目名称:microtrafficsim,代码行数:19,代码来源:OrthoInputController.java

示例2: mouseWheelMoved

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
/**
 * 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();

}
 
开发者ID:ClearVolume,项目名称:ClearVolume,代码行数:31,代码来源:MouseControl.java

示例3: mouseWheelMoved

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseWheelMoved(final MouseEvent e) {
    final Object attachment = e.getAttachment();
    if( attachment instanceof UIShape.PointerEventInfo ) {
        final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment;
        final boolean isOnscreen = PointerClass.Onscreen == e.getPointerType(0).getPointerClass();
        if( 0 == ( ~InputEvent.BUTTONALL_MASK & e.getModifiers() ) && !isOnscreen ) {
            // offscreen vertical mouse wheel zoom
            final float tz = 8f*e.getRotation()[1]; // vertical: wheel
            System.err.println("Rotate.Zoom.W: "+tz);
            shapeEvent.shape.translate(0f, 0f, tz);
        } else if( isOnscreen || e.isControlDown() ) {
            final float[] rot =  VectorUtil.scaleVec3(e.getRotation(), e.getRotation(), FloatUtil.PI / 180.0f);
            if( isOnscreen ) {
                System.err.println("XXX: "+e);
                // swap axis for onscreen rotation matching natural feel
                final float tmp = rot[0]; rot[0] = rot[1]; rot[1] = tmp;
                VectorUtil.scaleVec3(rot, rot, 2f);
            }
            shapeEvent.shape.getRotation().rotateByEuler( rot );
        }
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:24,代码来源:GPUUISceneGLListener0A.java

示例4: mouseWheelMoved

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseWheelMoved(MouseEvent e) {
    float r = e.getRotation()[1];
    if (r == 0)
        return;

    camera.zoom(-Displayer.CAMERA_ZOOM_MULTIPLIER_WHEEL * r);

    Displayer.render(0.5);
    wheelTimer.restart();
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:12,代码来源:Interaction.java


注:本文中的com.jogamp.newt.event.MouseEvent.getRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。