예제 #1
0
파일: Lens.java 프로젝트: vadyalex/thesis
  /**
   * Cursor moving event accured.
   *
   * @param gl OpenGL drawing context
   * @param glu GLU library. Used to convert coordinates from window coordinate system to OpenGL.
   */
  public void move(GL2 gl, GLU glu) {
    if (lensMovingCursorStartPosition != null && lensMovingCursorEndPosition != null) {
      double[] start = DrawingUtils.window2world(gl, glu, this.lensMovingCursorStartPosition);
      double[] end = DrawingUtils.window2world(gl, glu, this.lensMovingCursorEndPosition);

      double moveX = end[0] - start[0];
      double moveY = end[1] - start[1];

      keepLensInsideWindow(moveX, moveY);

      lensMovingCursorStartPosition = null;
    }
  }