public void dragged(int dx, int dy, boolean isControlDown, boolean isShiftDown) {
    if (camera instanceof edu.cmu.cs.stage3.alice.core.camera.OrthographicCamera) {
      if ((dx != 0) || (dy != 0)) {
        double divisor = isShiftDown ? 1000.0 : 50.0;
        double scaleFactor;
        if (Math.abs(dx) > Math.abs(dy)) {
          scaleFactor = 1.0 - ((double) dx) / divisor;
        } else {
          scaleFactor = 1.0 - ((double) dy) / divisor;
        }

        edu.cmu.cs.stage3.alice.core.camera.OrthographicCamera orthoCamera =
            (edu.cmu.cs.stage3.alice.core.camera.OrthographicCamera) camera;
        renderTarget.getAWTComponent().getSize(renderSize);

        double oldMinY = orthoCamera.minimumY.getNumberValue().doubleValue();
        double oldMaxY = orthoCamera.maximumY.getNumberValue().doubleValue();
        double oldPosX = orthoCamera.getPosition().x;
        double oldPosY = orthoCamera.getPosition().y;
        double oldHeight = oldMaxY - oldMinY;
        double pixelHeight = oldHeight / renderSize.getHeight();

        // (pressDX,pressDY) is vector from camera position to clicked point in world space
        double pressDX = (pressPoint.getX() - (renderSize.getWidth() / 2.0)) * pixelHeight;
        double pressDY = -(pressPoint.getY() - (renderSize.getHeight() / 2.0)) * pixelHeight;
        double pressX = oldPosX + pressDX;
        double pressY = oldPosY + pressDY;

        double newPosX = pressX - scaleFactor * pressDX;
        double newPosY = pressY - scaleFactor * pressDY;

        double newHeight = oldHeight * scaleFactor;
        double newMinY = -newHeight / 2.0;
        double newMaxY = -newMinY;

        orthoCamera.setPositionRightNow(newPosX, newPosY, 0.0);
        orthoCamera.minimumY.set(new Double(newMinY));
        orthoCamera.maximumY.set(new Double(newMaxY));
      }
    }
  }
  public void dragged(int dx, int dy, boolean isControlDown, boolean isShiftDown) {
    if (pickedTransformable != null) {
      boolean controlDown = isControlDown;
      boolean shiftDown = isShiftDown;

      double deltaFactor;
      if (camera instanceof edu.cmu.cs.stage3.alice.core.camera.OrthographicCamera) {
        edu.cmu.cs.stage3.alice.core.camera.OrthographicCamera orthoCamera =
            (edu.cmu.cs.stage3.alice.core.camera.OrthographicCamera) camera;
        double nearClipHeightInScreen =
            renderTarget
                .getAWTComponent()
                .getHeight(); // TODO: should be viewport, but not working right now
        double nearClipHeightInWorld =
            orthoCamera.getSceneGraphOrthographicCamera().getPlane()[3]
                - orthoCamera.getSceneGraphOrthographicCamera().getPlane()[1];
        deltaFactor = nearClipHeightInWorld / nearClipHeightInScreen;

        if (controlDown) {
          if (shiftDown) {
            helper.setTransformationRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.createIdentityMatrix4d(), camera);
            helper.setPositionRightNow(zeroVec, pickedTransformable);
            pickedTransformable.rotateRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.getXAxis(), -dy * .01, helper);
            pickedTransformable.rotateRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.getYAxis(), -dx * .01, pickedTransformable);
          } else {
            helper.setTransformationRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.createIdentityMatrix4d(), camera);
            helper.setPositionRightNow(zeroVec, pickedTransformable);
            pickedTransformable.rotateRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.getZAxis(), -dx * .01, helper);
          }
        } else if (shiftDown) {
          helper.setTransformationRightNow(
              edu.cmu.cs.stage3.math.MathUtilities.createIdentityMatrix4d(), camera);
          helper.setPositionRightNow(zeroVec, pickedTransformable);
          tempVec.x = 0.0;
          tempVec.y = -dy * deltaFactor;
          tempVec.z = 0.0;
          pickedTransformable.moveRightNow(tempVec, helper);
        } else {
          helper.setTransformationRightNow(
              edu.cmu.cs.stage3.math.MathUtilities.createIdentityMatrix4d(), camera);
          helper.setPositionRightNow(zeroVec, pickedTransformable);
          tempVec.x = dx * deltaFactor;
          tempVec.y = -dy * deltaFactor;
          tempVec.z = 0.0;
          pickedTransformable.moveRightNow(tempVec, helper);
        }
      } else {
        double projectionMatrix11 =
            renderTarget.getProjectionMatrix(camera.getSceneGraphCamera()).getElement(1, 1);
        double nearClipDist = camera.nearClippingPlaneDistance.doubleValue();
        double nearClipHeightInWorld = 2 * (nearClipDist / projectionMatrix11);
        double nearClipHeightInScreen =
            renderTarget
                .getAWTComponent()
                .getHeight(); // TODO: should be viewport, but not working right now
        double pixelHeight = nearClipHeightInWorld / nearClipHeightInScreen;
        //				double pixelHeight = nearClipHeightInWorld/300;
        double objectDist = pickedTransformable.getPosition(camera).getLength();
        deltaFactor = (objectDist * pixelHeight) / nearClipDist;

        if (controlDown) {
          if (shiftDown) {
            helper.setTransformationRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.createIdentityMatrix4d(), camera);
            helper.setPositionRightNow(zeroVec, pickedTransformable);
            pickedTransformable.rotateRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.getXAxis(), -dy * .01, helper);
            pickedTransformable.rotateRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.getYAxis(), -dx * .01, pickedTransformable);
          } else {
            helper.setTransformationRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.createIdentityMatrix4d(), world);
            helper.setPositionRightNow(zeroVec, pickedTransformable);
            pickedTransformable.rotateRightNow(
                edu.cmu.cs.stage3.math.MathUtilities.getYAxis(), -dx * .01, helper);
          }
        } else if (shiftDown) {
          helper.setTransformationRightNow(
              edu.cmu.cs.stage3.math.MathUtilities.createIdentityMatrix4d(), world);
          helper.setPositionRightNow(zeroVec, pickedTransformable);
          tempVec.x = 0.0;
          tempVec.y = -dy * deltaFactor;
          tempVec.z = 0.0;
          pickedTransformable.moveRightNow(tempVec, helper);
        } else {
          javax.vecmath.Matrix4d cameraTransformation =
              camera.getSceneGraphTransformable().getAbsoluteTransformation();
          cameraUp.x = cameraTransformation.m10;
          cameraUp.y = cameraTransformation.m11;
          cameraUp.z = cameraTransformation.m12;
          cameraForward.x = cameraTransformation.m20;
          cameraForward.y = cameraTransformation.m21;
          cameraForward.z = cameraTransformation.m22;

          helper.setPositionRightNow(zeroVec, pickedTransformable);
          if (Math.abs(cameraForward.y) < Math.abs(cameraUp.y)) { // if we're looking mostly level
            cameraForward.y = 0.0;
            helper.setOrientationRightNow(cameraForward, cameraUp, world);
          } else { // if we're looking mostly up or down
            cameraUp.y = 0.0;
            cameraForward.negate();
            helper.setOrientationRightNow(cameraUp, cameraForward, world);
          }

          tempVec.x = dx * deltaFactor;
          tempVec.y = 0.0;
          tempVec.z = -dy * deltaFactor;
          pickedTransformable.moveRightNow(tempVec, helper);
        }
      }
    }
  }