Merge branch 'documentation/JAL-2418_release2102' into develop
[jalview.git] / src / jalview / gui / SeqPanel.java
index 917925b..6fbed49 100644 (file)
@@ -189,6 +189,7 @@ public class SeqPanel extends JPanel implements MouseListener,
     int res = 0;
     int x = evt.getX();
 
+    int startRes = av.getRanges().getStartRes();
     if (av.getWrapAlignment())
     {
 
@@ -212,10 +213,11 @@ public class SeqPanel extends JPanel implements MouseListener,
       }
 
       wrappedBlock = y / cHeight;
-      wrappedBlock += av.getRanges().getStartRes() / cwidth;
-
+      wrappedBlock += startRes / cwidth;
+      // allow for wrapped view scrolled right (possible from Overview)
+      int startOffset = startRes % cwidth;
       res = wrappedBlock * cwidth
-              + Math.min(cwidth - 1, x / av.getCharWidth());
+              + Math.min(cwidth - 1, startOffset + x / av.getCharWidth());
     }
     else
     {
@@ -225,7 +227,7 @@ public class SeqPanel extends JPanel implements MouseListener,
         // right-hand gutter
         x = seqCanvas.getX() + seqCanvas.getWidth();
       }
-      res = (x / av.getCharWidth()) + av.getRanges().getStartRes();
+      res = (x / av.getCharWidth()) + startRes;
       if (res > av.getRanges().getEndRes())
       {
         // moused off right