X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSeqCanvas.java;h=5165aeae93f56e7d59856b7fbd17d637136066d6;hb=1e9f882c52f5b95d198c42973e7b2b1ce2b420df;hp=123e649838d401e19ed9d4667303e7fa44712f79;hpb=da8e34c5aeee5e83aa844d374eb21e4c2e3cebef;p=jalview.git diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 123e649..5165aea 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -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; @@ -371,7 +371,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI @Override public void paintComponent(Graphics g) { - if (av.getAlignPanel().getHoldRepaint()) { return; @@ -385,8 +384,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 +395,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,16 +502,16 @@ 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 + * @param w * the width in pixels (possibly including scales) * * @return the visible width in residues, after allowing for East or West * scales (if shown) * */ - public int getWrappedCanvasWidth(int width) + public int getWrappedCanvasWidth(int w) { int charWidth = av.getCharWidth(); @@ -550,7 +525,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI labelWidthWest = av.getScaleLeftWrapped() ? labelWidth : 0; - return (width - labelWidthEast - labelWidthWest) / charWidth; + return (w - labelWidthEast - labelWidthWest) / charWidth; } /** @@ -1710,11 +1685,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 +1705,8 @@ public class SeqCanvas extends JPanel implements ViewportListenerI } break; + default: + return; } ViewportRanges vpRanges = av.getRanges(); @@ -2248,4 +2220,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; + } + }