Commit 5958a67e authored by legoc's avatar legoc
Browse files

Do not show reference axes widgets depending on the type

parent 6ba52f2a
......@@ -384,6 +384,7 @@ public class EditorMenuBar extends MenuBar {
ComboBox<String> zeroValueReference1Box = new ComboBox<>(references);
zeroValueReference1Label.setVisible(selectedAxis.getType() == Axis.Type.ROTATION || selectedAxis.getType() == Axis.Type.TRANSLATION);
zeroValueReference1Box.setVisible(selectedAxis.getType() == Axis.Type.ROTATION || selectedAxis.getType() == Axis.Type.TRANSLATION);
reversedDirection1Check.setVisible(selectedAxis.getType() == Axis.Type.ROTATION);
// Select the reference axis.
if (selectedAxis.getZeroValueReferenceAxis1() != null) {
......@@ -513,6 +514,7 @@ public class EditorMenuBar extends MenuBar {
// Change the visibility of the zero value reference boxes and labels.
zeroValueReference1Label.setVisible(newValue == Axis.Type.ROTATION || newValue == Axis.Type.TRANSLATION);
zeroValueReference1Box.setVisible(newValue == Axis.Type.ROTATION || newValue == Axis.Type.TRANSLATION);
reversedDirection1Check.setVisible(newValue == Axis.Type.ROTATION);
zeroValueReference2Label.setVisible(newValue == Axis.Type.ROTATION);
zeroValueReference2Box.setVisible(newValue == Axis.Type.ROTATION);
......@@ -545,26 +547,42 @@ public class EditorMenuBar extends MenuBar {
controllerBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
// Select the controller.
selectedAxis.setController(NomadLinker.getInstance().getControllerByName(newValue));
// Set the text of the min and max labels.
minValueLabel.setText("Min Value : " + selectedAxis.getController().getMinPosition());
maxValueLabel.setText("Max Value : " + selectedAxis.getController().getMaxPosition());
// Set the type of axis based on the type of the controller.
Nomad3DController.Type type = selectedAxis.getController().getType();
if (!newValue.equals("")) {
if (type == Nomad3DController.Type.ROTATION) {
selectedAxis.setType(Axis.Type.ROTATION);
}
else if (type == Nomad3DController.Type.TRANSLATION) {
selectedAxis.setType(Axis.Type.TRANSLATION);
// Select the controller.
selectedAxis.setController(NomadLinker.getInstance().getControllerByName(newValue));
// Set the text of the min and max labels.
minValueLabel.setText("Min Value : " + selectedAxis.getController().getMinPosition());
maxValueLabel.setText("Max Value : " + selectedAxis.getController().getMaxPosition());
// Set the type of axis based on the type of the controller.
Nomad3DController.Type type = selectedAxis.getController().getType();
if (type == Nomad3DController.Type.ROTATION) {
selectedAxis.setType(Axis.Type.ROTATION);
}
else if (type == Nomad3DController.Type.TRANSLATION) {
selectedAxis.setType(Axis.Type.TRANSLATION);
}
else {
selectedAxis.setType(Axis.Type.FIXED);
}
typeBox.getSelectionModel().select(selectedAxis.getType());
}
else {
selectedAxis.setType(Axis.Type.FIXED);
// Reset the controller.
selectedAxis.setController(null);
// Set the text of the min and max labels.
minValueLabel.setText("");
maxValueLabel.setText("");
// Reset the type of axis.
selectedAxis.setType(Axis.Type.NONE);
typeBox.getSelectionModel().select(selectedAxis.getType());
}
typeBox.getSelectionModel().select(selectedAxis.getType());
}
});
......
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