adds an explicit clearing of the SeqCanvas fastPaint flag upon viewport
[jalview.git] / src / jalview / gui / SeqCanvas.java
index 2139b6b..1851200 100755 (executable)
@@ -52,6 +52,7 @@ import javax.swing.JPanel;
  * Wrapped mode, but not the scale above in Unwrapped mode.
  * 
  */
+@SuppressWarnings("serial")
 public class SeqCanvas extends JPanel implements ViewportListenerI
 {
   /*
@@ -290,7 +291,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
     }
     fastpainting = true;
     fastPaint = true;
-
     try
     {
       int charHeight = av.getCharHeight();
@@ -373,7 +373,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
     width -= (width % charWidth);
     height -= (height % charHeight);
 
-    
     if ((img != null) && (fastPaint
             || (getVisibleRect().width != g.getClipBounds().width)
             || (getVisibleRect().height != g.getClipBounds().height)))
@@ -1755,6 +1754,9 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
 
     fastPaint = true;
     fastpainting = true;
+    System.out
+            .println("fastpaintwrapped fastpainting true; fastPaint="
+                    + fastPaint);
 
     try
     {
@@ -2130,4 +2132,19 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
   {
     return labelWidthWest;
   }
+
+  /**
+   * Ensure that a full paint is done next, for whatever reason. This was
+   * necessary for JavaScript; apparently in Java the timing is just right on
+   * multiple threads (EventQueue-0, Consensus, Conservation) that we can get
+   * away with one fast paint before the others, but this ensures that in the
+   * end we get a full paint. Problem arose in relation to copy/paste, where the
+   * paste was not finalized with a full paint.
+   * 
+   * @author hansonr 2019.04.17
+   */
+  public void clearFastPaint()
+  {
+    fastPaint = false;
+  }
 }