changeset 9635:a03c54129819

pos 21 another review...
author dnt_bjoernsen <d.tironi@bjoernsen.de>
date Thu, 31 Oct 2019 15:24:23 +0100
parents 694062b1875a
children ac41551a8e4d 6c1ebf2220f5
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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"));

http://dive4elements.wald.intevation.org