Commit 14f2e67f authored by legoc's avatar legoc
Browse files

Changed place of direction normalization while modifying an axis

parent 9008b5c3
......@@ -289,7 +289,7 @@ public class EditorMenuBar extends MenuBar {
Point3D newDir = new Point3D(Double.parseDouble(xDirField.getText()),
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getY(),
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getZ());
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().setDirection(newDir.normalize());
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().setDirection(newDir);
} catch (Exception e) {
// Invalid input, nothing to do
}
......@@ -300,7 +300,7 @@ public class EditorMenuBar extends MenuBar {
Point3D newDir = new Point3D(Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getX(),
Double.parseDouble(yDirField.getText()),
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getZ());
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().setDirection(newDir.normalize());
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().setDirection(newDir);
} catch (Exception e) {
// Invalid input, nothing to do
}
......@@ -311,7 +311,7 @@ public class EditorMenuBar extends MenuBar {
Point3D newDir = new Point3D(Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getX(),
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getY(),
Double.parseDouble(zDirField.getText()));
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().setDirection(newDir.normalize());
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().setDirection(newDir);
} catch (Exception e) {
// Invalid input, nothing to do
}
......@@ -410,6 +410,10 @@ public class EditorMenuBar extends MenuBar {
// okButton.setDefaultButton(true);
okButton.setOnAction(okEvent -> {
updateThread.interrupt();
// Normalize here the direction, because the norm has an impact on the translation.
selectedAxis.setDirection(selectedAxis.getDirection().normalize());
selectedAxis.setMethod(Axis.Method.ADDED);
Nomad3DEditor.getInstance().getAxisBuilder().stop(selectedComponent);
Nomad3DEditor.getInstance().getModel().clearSelection();
......
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