}
scene.setZoomFactor(zoom);
}
if (scrollPane != null) {
scene.validate(); // Call validate to update size of scene
Dimension size = scrollPane.getViewport().getExtentSize();
viewPosition.x -= xOffset;
viewPosition.y -= yOffset;
scene.resolveBounds(scene.getLocation(), bounds);
scene.getView().setPreferredSize(componentSize);