JAL-3609 corrected maxdimension to mindimension. Adjusted tallscreen limit
[jalview.git] / src / jalview / bin / HiDPISetting.java
index 4472a19..3ff683e 100644 (file)
@@ -6,7 +6,7 @@ public class HiDPISetting
 {
   private static final int hidpiThreshold = 130;
 
-  private static final int tallScreenThreshold = 1300;
+  private static final int tallScreenThreshold = 1400;
 
   private static final String scalePropertyName = "sun.java2d.uiScale";
 
@@ -26,7 +26,7 @@ public class HiDPISetting
 
   public static int dpi = 0;
 
-  public static int maxdimension = 0;
+  public static int mindimension = 0;
 
   public static int width = 0;
 
@@ -84,8 +84,8 @@ public class HiDPISetting
     {
       int height = Toolkit.getDefaultToolkit().getScreenSize().height;
       int width = Toolkit.getDefaultToolkit().getScreenSize().width;
-      // using maxdimension in case of portrait screens
-      maxdimension = Math.max(height, width);
+      // using mindimension in case of portrait screens
+      mindimension = Math.min(height, width);
     } catch (Throwable t)
     {
       System.err.println("Cannot get screen size height and width");
@@ -97,21 +97,21 @@ public class HiDPISetting
     }
     else
     {
-      // attempt at a formula for scaling based on screen dpi and maxdimension.
+      // attempt at a formula for scaling based on screen dpi and mindimension.
       // scale
       // will be an integer >=1
-      if (dpi > 0 && maxdimension > 0)
+      if (dpi > 0 && mindimension > 0)
       {
         scale = Math.min(dpi / hidpiThreshold,
-                maxdimension / tallScreenThreshold) + 1;
+                mindimension / tallScreenThreshold) + 1;
       }
-      else if (dpi == 0 && maxdimension > tallScreenThreshold)
+      else if (dpi == 0 && mindimension > tallScreenThreshold)
       {
         // dpi couldn't be found but the screen has a large vertical pixel count
-        scale = maxdimension / tallScreenThreshold + 1;
+        scale = mindimension / tallScreenThreshold + 1;
       }
-      /* do nothing if maxdimension == 0 -- might be just a small HD screen (e.g. Gemini PDA)
-      else if (maxdimension == 0 && dpi > hidpiThreshold)
+      /* do nothing if mindimension == 0 -- might be just a small HD screen (e.g. Gemini PDA)
+      else if (mindimension == 0 && dpi > hidpiThreshold)
       {
       }
       */