Added more descriptive documentation to new classes and functionality

#story[1190]
This commit is contained in:
Connor Taylor-Brown
2017-09-08 23:48:47 +12:00
parent b034a452b6
commit 93883ee8b7
3 changed files with 40 additions and 7 deletions
@@ -128,6 +128,11 @@ public class View3D extends Pane {
return camera;
}
/**
* Provide the list of subjects to be automatically added or removed from the view as the list
* changes.
* @param items list managed by client
*/
public void setItems(ObservableList<Subject3D> items) {
this.items = items;
this.items.addListener((ListChangeListener<? super Subject3D>) c -> {
@@ -146,6 +151,9 @@ public class View3D extends Pane {
});
}
/**
* Intercept mouse clicks on subjects in view. The applied listener cannot be removed.
*/
public void enableTracking() {
scene.setOnMousePressed(e -> {
PickResult result = e.getPickResult();
@@ -155,6 +163,9 @@ public class View3D extends Pane {
});
}
/**
* Stop camera from following the last selected subject
*/
private void untrackSubject() {
if(target != null) {
target.getPosition().xProperty().removeListener(pivotX);
@@ -164,6 +175,10 @@ public class View3D extends Pane {
}
}
/**
* Set camera to follow the selected subject
* @param subject to track
*/
private void trackSubject(Subject3D subject) {
untrackSubject();
target = subject;
@@ -188,6 +203,10 @@ public class View3D extends Pane {
this.farClip = farClip;
}
/**
* Sets the coordinates of the camera pivot once.
* @param pivot source of coordinates
*/
public void updatePivot(Translate pivot) {
this.pivot.setX(pivot.getX());
this.pivot.setY(pivot.getY());