From 920cf6e2cee9cf58636c733b4ff29a406752f8aa Mon Sep 17 00:00:00 2001 From: Soman2 Date: Fri, 21 Jun 2019 12:27:19 +0200 Subject: [PATCH] Zoom view synchronization for products with different geocoding is normalized. --- .../main/java/org/esa/snap/ui/product/ProductSceneView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snap-ui/src/main/java/org/esa/snap/ui/product/ProductSceneView.java b/snap-ui/src/main/java/org/esa/snap/ui/product/ProductSceneView.java index 1cd3b55d72..7c6ba5cd66 100644 --- a/snap-ui/src/main/java/org/esa/snap/ui/product/ProductSceneView.java +++ b/snap-ui/src/main/java/org/esa/snap/ui/product/ProductSceneView.java @@ -1074,7 +1074,10 @@ public boolean synchronizeViewportIfPossible(ProductSceneView thatView) { thatGeoCoding.getPixelPos(geoCenter, imageCenter); if (imageCenter.isValid()) { thatView.getBaseImageLayer().getImageToModelTransform().transform(imageCenter, modelCenter); - thatViewport.setZoomFactor(thisViewport.getZoomFactor(), modelCenter.getX(), modelCenter.getY()); + double heightCoef = this.getModelBounds().getHeight() / thatView.getModelBounds().getHeight(); + double widthCoef = this.getModelBounds().getWidth() / thatView.getModelBounds().getWidth(); + double coef = Math.sqrt(heightCoef*widthCoef); + thatViewport.setZoomFactor(thisViewport.getZoomFactor()*coef, modelCenter.getX(), modelCenter.getY()); return true; } }