1

I have a Pane in a Group in a ScrollPane. I am attempting to implement mouse-relative zooming with the mouse-wheel for the Pane, but am unable to achieve it.

I was hoping it would be as simple as this: http://awhite.blogspot.fi/2013/02/javafx-pan-zoom.html, but for some incomprehensible reason, the Scale simply completely ignores the pivot point.. it is always at center.

I can post some code if needed.. but it doesn't differ much from the one in the article. Does anyone have idea why the Scale-object ignores the pivot point?

user2499946
  • 679
  • 1
  • 10
  • 28
  • 2
    I think the issue is probably that the scroll pane is not changing its viewport position in the way you want. So, while it may be zooming around the correct pivot, the viewport doesn't maintain the correct position in order for it to appear to zoom in the correct manner. Getting this right is (very) tricky: see http://stackoverflow.com/questions/16680295/javafx-correct-scaling/16682180#16682180 – James_D Sep 24 '14 at 19:15
  • OK, my original problem was an embarrassing mistake that I tried to scale the Pane, not the Group.. but I indeed had problems to get it working right even after it recognized the pivot. However, I got the zooming working flawlessly with your method. Thank you! – user2499946 Sep 25 '14 at 20:58

0 Answers0