Commit f9a31d00 authored by legoc's avatar legoc
Browse files

Reset the direction coordinates when changing the type

parent 94af7c06
...@@ -619,7 +619,9 @@ public class EditorMenuBar extends MenuBar { ...@@ -619,7 +619,9 @@ public class EditorMenuBar extends MenuBar {
typeBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Axis.Type>() { typeBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Axis.Type>() {
@Override @Override
public void changed(ObservableValue<? extends Axis.Type> observable, Axis.Type oldValue, Axis.Type newValue) { public void changed(ObservableValue<? extends Axis.Type> observable, Axis.Type oldValue, Axis.Type newValue) {
Nomad3DEditor.getInstance().getAxisBuilder().setType(newValue);
// Set the type.
editedAxis.setType(newValue);
// Reset the movement. // Reset the movement.
editedAxis.resetMovement(); editedAxis.resetMovement();
...@@ -641,6 +643,11 @@ public class EditorMenuBar extends MenuBar { ...@@ -641,6 +643,11 @@ public class EditorMenuBar extends MenuBar {
// Set the current value label text. // Set the current value label text.
valueText.setText(currentValueText(editedAxis.getType())); valueText.setText(currentValueText(editedAxis.getType()));
// Set the direction fields.
xDirField.setText(String.format("%.3f", editedAxis.getDirection().getX()));
yDirField.setText(String.format("%.3f", editedAxis.getDirection().getY()));
zDirField.setText(String.format("%.3f", editedAxis.getDirection().getZ()));
} }
}); });
...@@ -821,12 +828,12 @@ public class EditorMenuBar extends MenuBar { ...@@ -821,12 +828,12 @@ public class EditorMenuBar extends MenuBar {
Button okButton = new Button("OK"); Button okButton = new Button("OK");
okButton.setOnAction(okEvent -> { okButton.setOnAction(okEvent -> {
// Stop the build.
Nomad3DEditor.getInstance().getAxisBuilder().stop();
// Do not save the operation if the axis is the same. // Do not save the operation if the axis is the same.
if (!editedAxis.equals(initialAxis)) { if (!editedAxis.equals(initialAxis)) {
// Stop the build.
Nomad3DEditor.getInstance().getAxisBuilder().stop();
String referenceAxisName = null; String referenceAxisName = null;
String zeroValueReferenceAxis1Name = null; String zeroValueReferenceAxis1Name = null;
String zeroValueReferenceAxis2Name = null; String zeroValueReferenceAxis2Name = null;
...@@ -886,7 +893,9 @@ public class EditorMenuBar extends MenuBar { ...@@ -886,7 +893,9 @@ public class EditorMenuBar extends MenuBar {
Button cancelButton = new Button("Cancel"); Button cancelButton = new Button("Cancel");
cancelButton.setCancelButton(true); cancelButton.setCancelButton(true);
cancelButton.setOnAction(cancelEvent -> { cancelButton.setOnAction(cancelEvent -> {
Nomad3DEditor.getInstance().getAxisBuilder().stop(modified);
// Stop the build.
Nomad3DEditor.getInstance().getAxisBuilder().stop();
// Hide the axes. // Hide the axes.
editedAxis.setVisible(false); editedAxis.setVisible(false);
......
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