ExactMapping is in pdbchain
[jalview.git] / src / jalview / appletgui / SeqPanel.java
index 9c3a1e8..7c524ad 100755 (executable)
@@ -161,16 +161,26 @@ public class SeqPanel
 \r
   if (av.wrapAlignment)\r
   {\r
+\r
+    int hgap = av.charHeight;\r
+    if (av.scaleAboveWrapped)\r
+      hgap += av.charHeight;\r
+\r
+    int cHeight = av.getAlignment().getHeight() * av.charHeight\r
+        + hgap + seqCanvas.getAnnotationHeight();\r
+\r
       int y = evt.getY();\r
-      y -= (2 * av.charHeight);\r
+      y -= hgap;\r
       x -= seqCanvas.LABEL_WEST;\r
 \r
-      int chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
-      int cwidth = seqCanvas.getWrappedCanvasWidth(this.getSize().width);\r
-      wrappedBlock = y/chunkHeight;\r
-      wrappedBlock += av.getStartRes()/cwidth;\r
 \r
-      res = wrappedBlock*cwidth   +   x / av.getCharWidth();\r
+      int cwidth = seqCanvas.getWrappedCanvasWidth(getSize().width);\r
+\r
+      wrappedBlock = y / cHeight;\r
+      wrappedBlock += av.getStartRes() / cwidth;\r
+\r
+      res = wrappedBlock * cwidth + x / av.getCharWidth();\r
+\r
   }\r
   else\r
   {\r
@@ -183,14 +193,22 @@ public class SeqPanel
 \r
  int findSeq(MouseEvent evt)\r
  {\r
+\r
    int seq = 0;\r
    int y = evt.getY();\r
 \r
    if (av.wrapAlignment)\r
    {\r
-     y -= (2 * av.charHeight);\r
-     int chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
-     seq = ( (y % chunkHeight) / av.getCharHeight());\r
+     int hgap = av.charHeight;\r
+     if (av.scaleAboveWrapped)\r
+       hgap += av.charHeight;\r
+\r
+     int cHeight = av.getAlignment().getHeight() * av.charHeight\r
+         + hgap + seqCanvas.getAnnotationHeight();\r
+\r
+       y -= hgap;\r
+\r
+     seq = ( (y % cHeight) / av.getCharHeight());\r
    }\r
    else\r
    {\r
@@ -272,6 +290,11 @@ public class SeqPanel
       }\r
     }\r
 \r
+    if(seqCanvas.pdbCanvas!=null && sequence==seqCanvas.pdbCanvas.sequence)\r
+    {\r
+      seqCanvas.pdbCanvas.highlightRes(sequence.findPosition(res));\r
+    }\r
+\r
     ap.alignFrame.statusBar.setText(text.toString());\r
 \r
     // use aa to see if the mouse pointer is on a\r
@@ -284,7 +307,7 @@ public class SeqPanel
       while (e.hasMoreElements())\r
       {\r
         SequenceFeature sf = (SequenceFeature) e.nextElement();\r
-        if (sf.getStart() <= sequence.findPosition(res) &&\r
+        if (sf.getBegin() <= sequence.findPosition(res) &&\r
             sf.getEnd() >= sequence.findPosition(res))\r
         {\r
           if (sbuffer.length() > 0)\r