X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSeqCanvas.java;h=5667b6ef318d0326046b884169e0748d549b1734;hb=584c1b0136786968958e22e52b6ce51bd24511e5;hp=28c52919c44cc338940d22a325217f6fa2e80870;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 28c5291..5667b6e 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -491,16 +491,12 @@ public class SeqCanvas extends Panel implements ViewportListenerI HiddenColumns hidden = av.getAlignment().getHiddenColumns(); g.setColor(Color.blue); int res; - List positions = hidden.findHiddenRegionPositions(); + List positions = hidden.findHiddenRegionPositions(startRes, + endx + 1); for (int pos : positions) { res = pos - startRes; - if (res < 0 || res > endx - startRes) - { - continue; - } - gg.fillPolygon( new int[] { res * avcharWidth - avcharHeight / 4, @@ -510,7 +506,6 @@ public class SeqCanvas extends Panel implements ViewportListenerI { ypos - (avcharHeight / 2), ypos - (avcharHeight / 2), ypos - (avcharHeight / 2) + 8 }, 3); - } } @@ -559,8 +554,8 @@ public class SeqCanvas extends Panel implements ViewportListenerI return annotations.adjustPanelHeight(); } - private void drawPanel(Graphics g1, int startRes, int endRes, - int startSeq, int endSeq, int offset) + private void drawPanel(Graphics g1, final int startRes, final int endRes, + final int startSeq, final int endSeq, final int offset) { if (!av.hasHiddenColumns()) @@ -569,8 +564,8 @@ public class SeqCanvas extends Panel implements ViewportListenerI } else { - int screenY = 0; + final int screenYMax = endRes - startRes; int blockStart = startRes; int blockEnd = endRes; @@ -588,13 +583,22 @@ public class SeqCanvas extends Panel implements ViewportListenerI continue; } - blockEnd = hideStart - 1; + /* + * draw up to just before the next hidden region, or the end of + * the visible region, whichever comes first + */ + blockEnd = Math.min(hideStart - 1, blockStart + screenYMax + - screenY); g1.translate(screenY * avcharWidth, 0); draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); - if (av.getShowHiddenMarkers()) + /* + * draw the downline of the hidden column marker (ScalePanel draws the + * triangle on top) if we reached it + */ + if (av.getShowHiddenMarkers() && blockEnd == hideStart - 1) { g1.setColor(Color.blue); g1.drawLine((blockEnd - blockStart + 1) * avcharWidth - 1, @@ -607,14 +611,14 @@ public class SeqCanvas extends Panel implements ViewportListenerI screenY += blockEnd - blockStart + 1; blockStart = hideEnd + 1; - if (screenY > (endRes - startRes)) + if (screenY > screenYMax) { // already rendered last block return; } } } - if (screenY <= (endRes - startRes)) + if (screenY <= screenYMax) { // remaining visible region to render blockEnd = blockStart + (endRes - startRes) - screenY;