Merge branch 'bug/JAL-2577' into develop
[jalview.git] / src / jalview / viewmodel / ViewportRanges.java
index 743d212..4eb8c95 100644 (file)
@@ -123,7 +123,7 @@ public class ViewportRanges extends ViewportProperties
     int oldstartres = this.startRes;
     if (start > getVisibleAlignmentWidth() - 1)
     {
-      startRes = getVisibleAlignmentWidth() - 1;
+      startRes = Math.max(getVisibleAlignmentWidth() - 1, 0);
     }
     else if (start < 0)
     {
@@ -141,7 +141,7 @@ public class ViewportRanges extends ViewportProperties
     }
     else if (end > getVisibleAlignmentWidth() - 1)
     {
-      endRes = getVisibleAlignmentWidth() - 1;
+      endRes = Math.max(getVisibleAlignmentWidth() - 1, 0);
     }
     else
     {
@@ -208,7 +208,7 @@ public class ViewportRanges extends ViewportProperties
     int oldstartseq = this.startSeq;
     if (start > getVisibleAlignmentHeight() - 1)
     {
-      startSeq = getVisibleAlignmentHeight() - 1;
+      startSeq = Math.max(getVisibleAlignmentHeight() - 1, 0);
     }
     else if (start < 0)
     {
@@ -222,7 +222,7 @@ public class ViewportRanges extends ViewportProperties
     int oldendseq = this.endSeq;
     if (end >= getVisibleAlignmentHeight())
     {
-      endSeq = getVisibleAlignmentHeight() - 1;
+      endSeq = Math.max(getVisibleAlignmentHeight() - 1, 0);
     }
     else if (end < 0)
     {