JAL-192 need visible and actual sequence limits for scale
[jalview.git] / src / jalview / gui / ScalePanel.java
index f266d36..aedb157 100755 (executable)
@@ -494,7 +494,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
     int scalestartx = (startx / 10) * 10;
 
     SequenceI refSeq = av.getAlignment().getSeqrep();
-    int refSp = 0, refEp = -1;
+    int refSp = 0, refEp = -1, refStart = 0, refEnd = -1, refStartI = 0, refEndI = -1;
     if (refSeq != null)
     {
       // find bounds and set origin appopriately
@@ -504,6 +504,10 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
 
       refSp = refbounds[0];
       refEp = refbounds[1];
+      refStart = refbounds[2];
+      refEnd = refbounds[3];
+      refStartI = refbounds[4];
+      refEndI = refbounds[5];
       scalestartx = refSp + ((scalestartx - refSp) / 10) * 10;
     }
 
@@ -536,13 +540,13 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
           // TODO show bounds if position is a gap
           // - ie L--R -> "1L|2R" for
           // marker
-          if (iadj < refSp)
+          if (iadj < refStartI)
           {
-            string = String.valueOf(iadj - refSp);
+            string = String.valueOf(iadj - refStartI);
           }
-          else if (iadj > refEp)
+          else if (iadj > refEndI)
           {
-            string = "+" + String.valueOf(iadj - refEp);
+            string = "+" + String.valueOf(iadj - refEndI);
           }
           else
           {