JAL-3383 minor code tidying and commenting
[jalview.git] / src / jalview / gui / SeqCanvas.java
index 123e649..35be292 100755 (executable)
@@ -75,7 +75,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
 
   private final SequenceRenderer seqRdr;
 
-  boolean fastPaint = false;
+  private boolean fastPaint = false;
 
   private boolean fastpainting = false;
 
@@ -385,8 +385,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
     availWidth -= (availWidth % charWidth);
     availHeight -= (availHeight % charHeight);
 
-    // BH 2019 can't possibly fastPaint if either width or height is 0
-
     if (availWidth == 0 || availHeight == 0)
     {
       return;
@@ -398,28 +396,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
     int endRes = ranges.getEndRes();
     int endSeq = ranges.getEndSeq();
 
-    // [JAL-3226] problem that JavaScript (or Java) may consolidate multiple
-    // repaint() requests in unpredictable ways. In this case, the issue was
-    // that in response to a CTRL-C/CTRL-V paste request, in Java a fast
-    // repaint request preceded two full requests, thus resulting
-    // in a full request for paint. In constrast, in JavaScript, the three
-    // requests were bundled together into one, so the fastPaint flag was
-    // still present for the second and third request.
-    //
-    // This resulted in incomplete painting.
-    //
-    // The solution was to set seqCanvas.fastPaint and idCanvas.fastPaint false
-    // in PaintRefresher when the target to be painted is one of those two
-    // components.
-    //
-    // BH 2019.04.22
-    //
-    // An initial idea; can be removed once we determine this issue is closed:
-    // if (av.isFastPaintDisabled())
-    // {
-    // fastPaint = false;
-    // }
-
     Rectangle vis, clip;
     if (img != null
             && (fastPaint
@@ -527,7 +503,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
 
   /**
    * Using the current font, determine fields labelWidthEast and labelWidthWest,
-   * and return the number of residues that can fill the remaining width.
+   * and return the number of residues that can fill the remaining width
    * 
    * @param width
    *          the width in pixels (possibly including scales)
@@ -1710,11 +1686,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
       // typically scroll, but possibly just the end changed
       fastPaint(0, (int) evt.getNewValue() - (int) evt.getOldValue());
       return;
-    case ViewportRanges.ENDRES:
-    case ViewportRanges.ENDSEQ:
-      // meaning second event along with "START" -- ENDONLY,NOTSTART
-      // TODO: ignore??
-      return;
     case ViewportRanges.STARTRES:
       // meaning STARTOREND
       scrollX = (int) evt.getNewValue() - (int) evt.getOldValue();
@@ -1735,6 +1706,8 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
 
       }
       break;
+    default:
+      return;
     }
 
     ViewportRanges vpRanges = av.getRanges();
@@ -2248,4 +2221,13 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
     return labelWidthWest;
   }
 
+  /**
+   * Clears the flag that allows a 'fast paint' on the next repaint, so
+   * requiring a full repaint
+   */
+  public void setNoFastPaint()
+  {
+    fastPaint = false;
+  }
+
 }