Since I was always enthusiastic about computer graphics, I was thrilled, when JavaFX came out, as it was obviously a very natural fit for my software creations.
Unfortunately, it lacked (and still lacks) a simple to use container control, that would allow the user to pan and zoom its content out of the box (an elementary feature of every graphics editor I am aware of). And because I had a kind of “graphics editor” project in my head, when I started to play with JavaFX, this presented an obstacle to my plans. Not being able to find anything useful elsewhere, I decided to create such control on my own, and thats where the ZoomFX project was born.
My first attempt (back in early 2013 with JavaFX 2.2) was using traditional event listeners to update all the necessary values, because I haven’t yet grasped the full beauty of the binding concept in those early days), and it was actually quite a pain to get everything right (aside from the binding concept, I struggled with many more parts of JavaFX initially, like the difference between “bounds in local” and “bounds in parent”, affine transforms, etc.).
It wasn’t an easy start, but eventually it paid off, as I was getting into the JavaFX secrets quite fast, working on the control. After some weeks of struggle, I was able to solve all the initial difficulties, and the original version of the control (as imperfect as it was), served me flawlessly for nearly two years in my graphics editing project.
However, with two more years of JavaFX experience, its design shortcomings became gradually more and more evident, so recently I decided to reimplement the control from scratch, this time using the property binding approach. To my surprise, the experience was quite different from the first attempt, as this time I was able to get it running with much less lines of code in just one evening.
And since the control proved so useful to me, I decided to release it to the public, just in case there are some other graphics editing freaks like me, out there :)
To get an idea on how the control works, please see the following video:
If you’d like to try it live, you can download and run the demo app for yourself.