Commit 6a0c2b38 authored by Ivan Dages's avatar Ivan Dages
Browse files

modify axis : convenience buttons

parent 22cb5fc5
......@@ -24,6 +24,7 @@ import javafx.collections.ObservableList;
import javafx.collections.transformation.SortedList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Bounds;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Point3D;
......@@ -357,6 +358,26 @@ public class EditorMenuBar extends MenuBar {
}
});
Button reverseButton = new Button("Reverse axis");
reverseButton.setOnAction(reverseEvent -> {
Point3D newDir = new Point3D(
- Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getX(),
- Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getY(),
- Nomad3DEditor.getInstance().getAxisBuilder().getAxis().getDirection().getZ()
);
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().setDirection(newDir.normalize());
});
Button centerButton = new Button("Center axis");
centerButton.setOnAction(centerEvent -> {
Bounds bounds = selectedComponent.getSceneNode().localToScene(selectedComponent.getSceneNode().getBoundsInLocal());
Point3D center = new Point3D(
(bounds.getMinX() + bounds.getMaxX()) / 2,
(bounds.getMinY() + bounds.getMaxY()) / 2,
(bounds.getMinZ() + bounds.getMaxZ()) / 2
);
Nomad3DEditor.getInstance().getAxisBuilder().getAxis().setPosition(center);
});
Button okButton = new Button("OK");
// okButton.setDefaultButton(true);
okButton.setOnAction(okEvent -> {
......@@ -391,11 +412,19 @@ public class EditorMenuBar extends MenuBar {
GridPane.setColumnSpan(typeBox, GridPane.REMAINING);
addPane.addRow(0, typePane);
GridPane conveniencePane = new GridPane();
conveniencePane.setHgap(10);
conveniencePane.setVgap(5);
conveniencePane.setAlignment(Pos.CENTER);
conveniencePane.addRow(0, reverseButton, centerButton);
addPane.addRow(1, conveniencePane);
GridPane.setMargin(conveniencePane, new Insets(10));
GridPane buttonPane = new GridPane();
buttonPane.setHgap(10);
buttonPane.setAlignment(Pos.CENTER);
buttonPane.addRow(0, okButton, cancelButton);
addPane.addRow(1, buttonPane);
addPane.addRow(2, buttonPane);
Nomad3DEditor.getInstance().getAxisBuilder().start(selectedAxis, Nomad3DEditor.getInstance().getRoot(), Nomad3DEditor.getInstance().getControls(), modified);
updateThread.start();
......
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