diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/BowlerStudio.java b/src/main/java/com/neuronrobotics/bowlerstudio/BowlerStudio.java index 2b1740dbf..754198154 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/BowlerStudio.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/BowlerStudio.java @@ -890,4 +890,9 @@ public static void setCamera(TransformNR tf) { CreatureLab3dController.getEngine().moveCamera(tfupde); }); } + public static void zoomCamera(double increment) { + runLater(()->{ + CreatureLab3dController.getEngine().zoomIncrement(increment); + }); + } } diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/threed/BowlerStudio3dEngine.java b/src/main/java/com/neuronrobotics/bowlerstudio/threed/BowlerStudio3dEngine.java index 9dd439cbe..3a6ff868d 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/threed/BowlerStudio3dEngine.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/threed/BowlerStudio3dEngine.java @@ -1184,20 +1184,25 @@ public void handle(MouseEvent me) { scene.addEventHandler(ScrollEvent.ANY, t -> { if (ScrollEvent.SCROLL == t.getEventType()) { - double zoomFactor = -(t.getDeltaY()) * getVirtualcam().getZoomDepth() / 500; - // - // double z = camera.getTranslateY(); - // double newZ = z + zoomFactor; - // camera.setTranslateY(newZ); - // System.out.println("Z = "+zoomFactor); - - getVirtualcam().setZoomDepth(getVirtualcam().getZoomDepth() + zoomFactor); + double deltaY = t.getDeltaY(); + zoomIncrement(deltaY); } t.consume(); }); } + public void zoomIncrement(double deltaY) { + double zoomFactor = -deltaY * getVirtualcam().getZoomDepth() / 500; + // + // double z = camera.getTranslateY(); + // double newZ = z + zoomFactor; + // camera.setTranslateY(newZ); + // System.out.println("Z = "+zoomFactor); + + getVirtualcam().setZoomDepth(getVirtualcam().getZoomDepth() + zoomFactor); + } + public void moveCamera(TransformNR newPose) { getFlyingCamera().DriveArc(newPose); }