本文整理汇总了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);
}
示例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();
}
示例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 );
}
}
}
示例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();
}