Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
Protos
Nomad 3D
nomad-3d-editor
Commits
6a0c2b38
Commit
6a0c2b38
authored
Jun 28, 2017
by
Ivan Dages
Browse files
modify axis : convenience buttons
parent
22cb5fc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/n3d/gui/EditorMenuBar.java
View file @
6a0c2b38
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment