In this chapter, we will implement the mouse zoom control. Currently we have complete rotation freedom on the mouse. With Zoom in/out effect, we can control the Z-axis.
This zoom control will be based on mouse scrolling. JavaFX provides option to listen for mouse scroll event. We will make use of that.
//Attach a scroll listener stage.addEventHandler(ScrollEvent.SCROLL, event -> { //Get how much scroll was done in Y axis. double delta = event.getDeltaY(); //Add it to the Z-axis location. group.translateZProperty().set(group.getTranslateZ() + delta); });
ScrollEvent.SCROLL allows to track the scrolling. JavaFX provides support for tracking horizontal scrolling (which can be obtained using event.getDeltaX()) as well as vertical scrolling (which can be obtained using event.getDeltaY()). Currently we are interested in vertical scrolling only.
When we scroll upward, the value will be positive. Then the Z axis value will increase and object will go away. When the scroll is downward, Z value will be decreased and the object will come closer.
… [Trackback]
[…] Find More here on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Info to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Info to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Read More Info here to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Here you will find 4315 additional Info to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Info on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More Information here on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] There you can find 81930 additional Information on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More on to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Read More here to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] There you will find 35360 additional Information to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Info on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Read More here to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Here you will find 15545 more Info on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More on on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Info to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More Information here on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Info to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More here on that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]
… [Trackback]
[…] Find More Info here to that Topic: genuinecoder.com/javafx-3d-mouse-control-zoom/ […]