Zooming in while in birds eye no longer clips through sea surface.

Zooming with mouse wheel is the same speed as zooming with keyboard.
main
fjc40 8 years ago
parent 75f8231bc5
commit 5d9b574378

@ -576,7 +576,12 @@ public class RaceViewController extends Controller {
// Bind zooming to scrolling // Bind zooming to scrolling
view3D.setOnScroll(e -> { view3D.setOnScroll(e -> {
view3D.updateDistance(e.getDeltaY()); //view3D.updateDistance(e.getDeltaY());
if (e.getDeltaY() > 0) {
view3D.zoomIn();
} else {
view3D.zoomOut();
}
}); });
// Bind zooming to keypress (Z/X default) // Bind zooming to keypress (Z/X default)

@ -268,8 +268,10 @@ public class View3D extends Pane {
public void updateDistance(double delta) { public void updateDistance(double delta) {
double newDistance = -this.distance.getZ() + delta; double newDistance = -this.distance.getZ() + delta;
if (target.get() == null){ if (target.get() == null){
if (newDistance > MAX_ZOOM_LIMIT){ if (newDistance > MAX_ZOOM_LIMIT) {
setDistance(MAX_ZOOM_LIMIT); setDistance(MAX_ZOOM_LIMIT);
} else if (newDistance <= ZOOM_IN_LIMIT) {
setDistance(ZOOM_IN_LIMIT);
} else { } else {
setDistance(newDistance); setDistance(newDistance);
} }
@ -372,4 +374,4 @@ public class View3D extends Pane {
public void addPointLight(PointLight pointLight) { public void addPointLight(PointLight pointLight) {
this.world.getChildren().add(pointLight); this.world.getChildren().add(pointLight);
} }
} }

Loading…
Cancel
Save