JAL-3212 unit test and fix for Scale Panel bug
[jalview.git] / src / jalview / gui / ScalePanel.java
index b95c569..b392c8f 100755 (executable)
@@ -279,14 +279,15 @@ public class ScalePanel extends JPanel
     ap.getSeqPanel().stopScrolling();
 
     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)