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


Java MouseEvent.getY方法代码示例

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


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

示例1: mouseDragged

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
    // called when a mouse button is waiting for release and the mouse is moving

    // set the mouse location
    this.moved = true;
    this.location = new Point(e.getX(), e.getY());
    // set the mouse button pressed flag
    int code = e.getButton();
    MouseButton mb = this.buttons.get(code);
    // check if the mouse event is in the map
    if (mb == null) {
        // if not, then add it
        mb = new MouseButton(code);
        this.buttons.put(code, mb);
    }
    mb.setPressed(true);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:19,代码来源:Mouse.java

示例2: 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

示例3: mousePressed

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

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

示例4: gestureDetected

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void gestureDetected(final GestureEvent gh) {
    if( null != activeShape ) {
        // gesture .. delegate to active shape!
        final InputEvent orig = gh.getTrigger();
        if( orig instanceof MouseEvent ) {
            final MouseEvent e = (MouseEvent) orig;
            // flip to GL window coordinates
            final int glWinX = e.getX();
            final int glWinY = viewport[3] - e.getY() - 1;
            final float[] objPos = new float[3];
            final UIShape shape = activeShape;
            windowToShapeCoords(shape, glWinX, glWinY, objPos, new Runnable() {
                public void run() {
                    shape.dispatchGestureEvent(gh, glWinX, glWinY, objPos);
                } } );
        }
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:20,代码来源:SceneUIController.java

示例5: mouseDragged

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
    int x = e.getX();
    int y = e.getY();

    double scale = view.getScale();
    double diffX = (x - prevX) * (1.0 / scale);
    double diffY = (y - prevY) * (1.0 / scale);

    Vec3d pos = view.getPosition();
    view.setPosition(pos.x - diffX, pos.y + diffY);

    prevX = x;
    prevY = y;
}
 
开发者ID:sgs-us,项目名称:microtrafficsim,代码行数:16,代码来源:OrthoInputController.java

示例6: mouseDragged

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
    int x = e.getX() - lastX;
    int y = e.getY() - lastY;
    lastX = e.getX();
    lastY = e.getY();

    Vec2 pan = camera.getCurrentTranslation();
    double m = 2. * camera.getWidth() / Displayer.getActiveViewport().height;
    camera.setCurrentTranslation(pan.x + x * m, pan.y - y * m);
    Displayer.render(0.5);
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:13,代码来源:InteractionPan.java

示例7: mouseMoved

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
    if (Displayer.getUpdateViewpoint() == UpdateViewpoint.equatorial) {
        mouseX = e.getX();
        mouseY = e.getY();
        Camera camera = Displayer.getCamera();
        Vec3 v = CameraHelper.getVectorFromPlane(camera, Displayer.getActiveViewport(), mouseX, mouseY, Quat.ZERO, true);
        if (v == null)
            return;

        double width = camera.getWidth(), minDist = 10;
        String name = null;
        for (Map.Entry<LoadPosition, Position.L> entry : UpdateViewpoint.equatorial.getPositions()) {
            Position.L p = entry.getValue();
            double deltaX = Math.abs(p.rad * Math.cos(p.lon) - v.x);
            double deltaY = Math.abs(p.rad * Math.sin(p.lon) - v.y);
            double dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY) / width;
            if (dist < minDist) {
                minDist = dist;
                name = entry.getKey().getTarget().toString();
            }
        }
        if (!text.isEmpty()) {
            text.clear();
            Displayer.display();
        }
        if (minDist < 0.01) {
            text.add(name);
            Displayer.display();
        }
    }
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:33,代码来源:ViewpointLayer.java

示例8: handleArcBall

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

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

示例9: moveLight

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
private void moveLight(final MouseEvent pMouseEvent)
{
  final float lMouseX = pMouseEvent.getX();
  final float lMouseY = pMouseEvent.getY();
  final float light[] = new float[3];
  mArcBall.mapToSphere(lMouseX, lMouseY, light);
  mRenderer.setLightVector(light);
}
 
开发者ID:ClearVolume,项目名称:ClearVolume,代码行数:9,代码来源:MouseControl.java

示例10: handleTranslation

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
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);
}
 
开发者ID:ClearVolume,项目名称:ClearVolume,代码行数:16,代码来源:MouseControl.java

示例11: mousePressed

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@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);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:13,代码来源:SceneUIController.java

示例12: mouseReleased

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(final MouseEvent e) {
    // flip to GL window coordinates
    final int glWinX = e.getX();
    final int glWinY = viewport[3] - e.getY() - 1;
    dispatchMouseEvent(e, glWinX, glWinY);
    if( 1 == e.getPointerCount() ) {
        // Release active shape: last pointer has been lifted!
        release();
        clear();
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:13,代码来源:SceneUIController.java

示例13: mouseClicked

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(final MouseEvent e) {
    // flip to GL window coordinates
    final int glWinX = e.getX();
    final int glWinY = viewport[3] - e.getY() - 1;
    // activeId should have been released by mouseRelease() already!
    dispatchMouseEventPickShape(e, glWinX, glWinY, false);
    // Release active shape: last pointer has been lifted!
    release();
    clear();
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:12,代码来源:SceneUIController.java

示例14: mouseDragged

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:15,代码来源:SceneUIController.java

示例15: mouseMoved

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseMoved(final MouseEvent e) {
    if( -1 == lId || e.getPointerId(0) == lId ) {
        lx = e.getX();
        ly = e.getY();
        lId = e.getPointerId(0);
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:9,代码来源:SceneUIController.java


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