java - JavaFX How do you convert coordinates (relative to the screen) to coordinates (relative to a pane)? -
i'm going coordinates of cursor java.awt.mouseinfo , need convert coordinate relative scrollpane's viewport. i'm trying have scrollpane's scrollbar positions center on mouse when zooming in/out.
viewscroll scrollpane. zoomgroup group containing imageview scaled (zooming). when scaled method repositions scrollbars before scale. want reposition scrollbars mouse @ time of zooming.
protected void zoom(double scalevalue) { p = mouseinfo.getpointerinfo().getlocation(); double y = p.getx(); double x = p.gety(); double scrollh = viewscroll.gethvalue(); double scrollv = viewscroll.getvvalue(); zoomgroup.setscalex(scalevalue); zoomgroup.setscaley(scalevalue); viewscroll.sethvalue(y); viewscroll.setvvalue(x); }
Comments
Post a Comment