Skip to content

Commit

Permalink
[449870] Zoom relative to the mouse pointer location.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwienand committed Dec 19, 2014
1 parent d1f17ca commit a646ad8
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ public void scroll(ScrollEvent event) {
public void zoomRelative(double relativeZoom, double sceneX, double sceneY) {
ViewportModel viewportModel = getHost().getRoot().getViewer()
.getAdapter(ViewportModel.class);
FXRootPart root = (FXRootPart) getHost().getRoot();
Point2D contentLayerPivot = root.getContentLayer().sceneToLocal(sceneX,
sceneY);
// TODO: pivot
Point2D contentGroupPivot = ((FXRootPart) getHost().getRoot())
.getScrollPane().getContentGroup().sceneToLocal(sceneX, sceneY);
viewportModel.setContentsTransform(viewportModel.getContentsTransform()
.concatenate(
new AffineTransform()
.translate(-contentLayerPivot.getX(),
-contentLayerPivot.getY())
.translate(contentGroupPivot.getX(),
contentGroupPivot.getY())
.scale(relativeZoom, relativeZoom)
.translate(contentLayerPivot.getX(),
contentLayerPivot.getY())));
.translate(-contentGroupPivot.getX(),
-contentGroupPivot.getY())));
}

}

0 comments on commit a646ad8

Please sign in to comment.