void () { ZoomOptions zoomOptions = getZoomOptions(); Double smartZoomFactor = zoomOptions.getSmartZoomFactor(imageComponent.getDocument().getBounds(), myScrollPane.getViewport().getExtentSize(), ImageComponent.IMAGE_INSETS); if (smartZoomFactor != null) { zoomModel.setZoomFactor(smartZoomFactor); } else { zoomModel.setZoomFactor(1.0d); } myZoomLevelChanged = false; }