JAL-2265 turn off NPE
authorkiramt <k.mourao@dundee.ac.uk>
Tue, 15 Aug 2017 10:48:33 +0000 (11:48 +0100)
committerkiramt <k.mourao@dundee.ac.uk>
Tue, 15 Aug 2017 10:48:33 +0000 (11:48 +0100)
src/jalview/gui/SeqCanvas.java
src/jalview/gui/SeqPanel.java

index a134afa..edb41e6 100755 (executable)
@@ -820,8 +820,10 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
 
         for (i = startSeq; i <= endSeq; i++)
         {
+          // position of start residue of group relative to startRes, in pixels
           sx = (group.getStartRes() - startRes) * charWidth;
           sy = offset + ((i - startSeq) * charHeight);
+          // width of group in pixels
           ex = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) - 1;
 
           if (sx + ex < 0 || sx > visWidth)
@@ -870,11 +872,15 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
           {
             if (inGroup)
             {
+              // if start position is visible, draw vertical line to left of
+              // group
               if (sx >= 0 && sx < visWidth)
               {
                 g.drawLine(sx, oldY, sx, sy);
               }
 
+              // if end position is visible, draw vertical line to right of
+              // group
               if (sx + ex < visWidth)
               {
                 g.drawLine(sx + ex, oldY, sx + ex, sy);
@@ -882,8 +888,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
 
               if (sx < 0)
               {
-                ex += sx;
-                sx = 0;
+                // ex += sx;
+                // sx = 0;
               }
 
               if (sx + ex > visWidth)
@@ -896,12 +902,14 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
                 ex = (endRes - startRes + 1) * charWidth;
               }
 
+              // draw horizontal line at top of group
               if (top != -1)
               {
                 g.drawLine(sx, top, sx + ex, top);
                 top = -1;
               }
 
+              // draw horizontal line at bottom of group
               if (bottom != -1)
               {
                 g.drawLine(sx, bottom, sx + ex, bottom);
index 26096e6..2daa157 100644 (file)
@@ -1940,7 +1940,7 @@ public class SeqPanel extends JPanel implements MouseListener,
       scrollThread.setEvent(evt);
     }
 
-    seqCanvas.repaint();
+    // seqCanvas.repaint();
   }
 
   void scrollCanvas(MouseEvent evt)