Merge branch 'develop' into Jalview-JS/develop
[jalview.git] / src / jalview / gui / ScalePanel.java
index 9c2b42f..bb15bd2 100755 (executable)
@@ -48,7 +48,6 @@ import java.util.List;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
-import javax.swing.SwingUtilities;
 import javax.swing.ToolTipManager;
 
 /**
@@ -278,15 +277,15 @@ public class ScalePanel extends JPanel
 
     // todo res calculation should be a method on AlignViewport
     int xCords = Math.max(0, evt.getX()); // prevent negative X coordinates
+    ViewportRanges ranges = av.getRanges();
     int res = (xCords / av.getCharWidth())
-            + av.getRanges().getStartRes();
-
+            + ranges.getStartRes();
+    res = Math.min(res, ranges.getEndRes());
     if (av.hasHiddenColumns())
     {
       res = av.getAlignment().getHiddenColumns()
               .visibleToAbsoluteColumn(res);
     }
-    res = Math.min(res, av.getRanges().getEndRes());
     res = Math.max(0, res);
 
     if (!stretchingGroup)