[PATCH] pos 21 another review

Wald Commits scm-commit at wald.intevation.org
Thu Oct 31 15:24:30 CET 2019


# HG changeset patch
# User dnt_bjoernsen <d.tironi at bjoernsen.de>
# Date 1572531863 -3600
#      Thu Oct 31 15:24:23 2019 +0100
# Node ID a03c541298190dd202a5b3892b95811afd5f4f99
# Parent  694062b1875a3dedb2f71cddb0df89063d4cea9a
pos 21 another review...

diff -r 694062b1875a -r a03c54129819 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java	Thu Oct 31 12:09:31 2019 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java	Thu Oct 31 15:24:23 2019 +0100
@@ -89,13 +89,18 @@
             final int imageWidth = image.getWidth();
             final int imageHeight = image.getHeight();
             final double widthPercent = imageWidth / 400.;
-            final double heightPercent = imageHeight / 150.;
-            if (widthPercent > 1 || heightPercent > 1) {
-                if (widthPercent > heightPercent)
-                    image.setSize((int) (imageWidth / widthPercent) + "px", (int) (imageHeight / widthPercent) + "px");
-                else
-                    image.setSize((int) (imageWidth / heightPercent) + "px", (int) (imageHeight / heightPercent) + "px");
-            }
+
+            // removing the limit of 150px height (legend can have an infinite height now,
+            // as long as the width is less/eq 400px; if the width is >400,
+            // the legend will be scaled to 400px width; the ratio will be kept)
+
+            // final double heightPercent = imageHeight / 150.;
+            if (widthPercent > 1)// || heightPercent > 1) {
+                // if (widthPercent > heightPercent)
+                image.setSize((int) (imageWidth / widthPercent) + "px", (int) (imageHeight / widthPercent) + "px");
+            // else
+            // image.setSize((int) (imageWidth / heightPercent) + "px", (int) (imageHeight / heightPercent) + "px");
+            // }
             return image;
         }
         final String imgUrl = MapUtils.getLegendGraphicUrl(at.getAttr("url"), at.getAttr("layers"));


More information about the Dive4Elements-commits mailing list