From 4f30cce34289ac0c2dee7b65218f8b98a6a63172 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 22 Nov 2016 16:41:36 +0000 Subject: [PATCH] JAL-2337 fix: only adjust once for scroll offset --- src/jalview/gui/AlignmentPanel.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 6554655..921429b 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1062,7 +1062,7 @@ public class AlignmentPanel extends GAlignmentPanel implements + 3; /* - * draw the Scale at horizontal offset, then reset to origin + * draw the Scale at horizontal offset, then reset to top left (0, 0) */ alignmentGraphics.translate(alignmentGraphicsOffset, 0); getScalePanel().drawScale(alignmentGraphics, startRes, endRes, @@ -1071,7 +1071,7 @@ public class AlignmentPanel extends GAlignmentPanel implements /* * Draw the sequence ids, offset for scale height, - * then reset to origin + * then reset to top left (0, 0) */ idGraphics.translate(0, scaleHeight); idGraphics.setFont(getIdPanel().getIdCanvas().getIdfont()); @@ -1122,7 +1122,7 @@ public class AlignmentPanel extends GAlignmentPanel implements /* * draw the sequences, offset for scale height, and id width (if using a - * single graphics context), then reset to origin + scale height + * single graphics context), then reset to (0, scale height) */ alignmentGraphics.translate(alignmentGraphicsOffset, scaleHeight); getSeqPanel().seqCanvas.drawPanel(alignmentGraphics, startRes, endRes, @@ -1132,16 +1132,19 @@ public class AlignmentPanel extends GAlignmentPanel implements if (av.isShowAnnotation() && (endSeq == alignmentHeight)) { /* - * draw annotation labels, offset for current scroll position - * then reset to origin + scale height + * draw annotation labels; drawComponent() translates by + * getScrollOffset(), so compensate for that first; + * then reset to (0, scale height) */ - int offset = -getAlabels().getScrollOffset(); - idGraphics.translate(0, offset + alignmentDrawnHeight); + int offset = getAlabels().getScrollOffset(); + idGraphics.translate(0, -offset); + idGraphics.translate(0, alignmentDrawnHeight); getAlabels().drawComponent(idGraphics, idWidth); - idGraphics.translate(0, -offset - alignmentDrawnHeight); + idGraphics.translate(0, -alignmentDrawnHeight); /* - * draw the annotations + * draw the annotations starting at + * (idOffset, alignmentHeight) from (0, scaleHeight) */ alignmentGraphics.translate(alignmentGraphicsOffset, alignmentDrawnHeight); getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av, -- 1.7.10.2