position of bioinformatics
[jalview.git] / src / jalview / gui / SeqCanvas.java
index 6dc2acd..9b59309 100755 (executable)
@@ -133,11 +133,19 @@ public void fastPaint(int horizontal, int vertical)
 \r
     else if (vertical > 0) // scroll down\r
     {\r
-      transY = imgHeight - vertical * av.charHeight;\r
       ss = es - vertical;\r
+      if(ss<av.startSeq) // ie scrolling too fast, more than a page at a time\r
+        ss = av.startSeq;\r
+      else\r
+        transY = imgHeight - vertical * av.charHeight;\r
     }\r
     else if (vertical < 0)\r
+    {\r
       es = ss - vertical;\r
+      if(es > av.endSeq)\r
+        es = av.endSeq;\r
+    }\r
+\r
 \r
     gg.translate(transX, transY);\r
 \r
@@ -241,7 +249,7 @@ public void fastPaint(int horizontal, int vertical)
       int  ypos  = 2*av.charHeight;\r
 \r
 \r
-      while (ypos <= canvasHeight && endx <al.getWidth())\r
+      while (ypos <= canvasHeight)\r
       {\r
         g.setColor(Color.black);\r
 \r
@@ -355,7 +363,7 @@ public void fastPaint(int horizontal, int vertical)
         {\r
           sx = (group.getStartRes() - startx) * av.charWidth;\r
           sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
-          ex = (group.getEndRes() + 1 - group.getStartRes()) * av.charWidth;\r
+          ex = (group.getEndRes() + 1 - group.getStartRes()) * av.charWidth -1;\r
 \r
           if (av.getWrapAlignment())\r
           {\r
@@ -363,15 +371,8 @@ public void fastPaint(int horizontal, int vertical)
               sx = 0;\r
 \r
             if (ex > getWidth())\r
-            {\r
-              if (av.getWrapAlignment())\r
                 ex = getWrappedCanvasWidth(getWidth()) * av.charWidth;\r
-\r
-            }\r
           }\r
-          else if(ex>getWidth())\r
-            ex -= av.charWidth;\r
-\r
 \r
           if (sx < getWidth()\r
               && ex > 0\r