How to scale the scrollpane's Vvalue
It is my first time using javaFX 2 and I am having problems with the scrollPane's Vvalue.
I am trying to keep track of the top left hand corner of the viewport because I want to render objects as I move around and I need to know the co-ordinates around the viewport.
The current compensation I am trying to use it:
double tempX = ((scroll.hvalueProperty().get()) * CANVASSIZE) - ((scroll.hvalueProperty().get()) * scrollPaneWidth);
double tempY = ((scroll.vvalueProperty().get()) * CANVASSIZE) - ((scroll.vvalueProperty().get()) * (scrollPaneHeight));
But this attempt is not 100% correct.
After this works I also scaling the scrollPane's content, so I also want to scale the x and y co-oordinates with the scale.
Does anyone have some insight in the problem?
I found a solution:
tempY = (scroll.vvalueProperty().get()) * (CANVASSIZE- scrollPaneHeight/tempScale);
I was just trying to make a pannable scrollPane and I had the scrollBars visible so that I could see where I was, but that messed up the calculations. When I set the scrollbar's visibility off, the code worked.