Commit 5f11cc40 authored by Ivan Dages's avatar Ivan Dages
Browse files

camera controls : consitency between editor and viewer

parent 66c0f507
......@@ -5,6 +5,7 @@ import javafx.geometry.Point3D;
import javafx.scene.Camera;
import javafx.scene.Node;
import javafx.scene.transform.Affine;
import javafx.scene.transform.NonInvertibleTransformException;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Translate;
......@@ -290,15 +291,29 @@ public class CameraControls {
*/
public void translate(Point2D delta, boolean isControlDown, boolean isShiftDown, boolean isAltDown) {
double modifier = modifier(isControlDown, isShiftDown);
Point3D xAxis = Rotate.X_AXIS;
Point3D yAxis = Rotate.Y_AXIS;
try {
xAxis = transform.inverseDeltaTransform(Rotate.X_AXIS).normalize();
yAxis = transform.inverseDeltaTransform(Rotate.Y_AXIS).normalize();
} catch (NonInvertibleTransformException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Point3D translation = null;
Point3D translation = new Point3D(0, 0, 0);
translation = translation.add(xAxis.multiply(- translationSensitivity * delta.getX()));
translation = translation.add(yAxis.multiply(- translationSensitivity * delta.getY()));
/*
if (isAltDown) {
translation = new Point3D(0, translationSensitivity * delta.getY(), 0);
} else {
translation = new Point3D(translationSensitivity * delta.getX(), 0, translationSensitivity * delta.getY());
translation = new Point3D(translationSensitivity * delta.getX(), translationSensitivity * delta.getY(), 0);
}
Rotate lonRot = new Rotate(longitude, Rotate.Y_AXIS);
translation = lonRot.transform(translation);
*/
center = center.add(translation.multiply(modifier));
update();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment