JAL-4375 Pass through a flag to AnnotationRenderer.drawComponent(...) so it knows...
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index 0da5603..2856868 100644 (file)
@@ -525,6 +525,14 @@ public class AnnotationRenderer
           AlignViewportI av, Graphics g, int activeRow, int startRes,
           int endRes)
   {
+    return drawComponent(annotPanel, av, g, activeRow, startRes, endRes,
+            false);
+  }
+
+  public boolean drawComponent(AwtRenderPanelI annotPanel,
+          AlignViewportI av, Graphics g, int activeRow, int startRes,
+          int endRes, boolean forExport)
+  {
     if (g instanceof EpsGraphics2D || g instanceof SVGGraphics2D)
     {
       this.setVectorRendering(true);
@@ -780,7 +788,13 @@ public class AnnotationRenderer
               // This removes artifacts from text when side scrolling
               // (particularly in wrap format), but can result in clipped
               // characters until a full paint is drawn.
-              g2dCopy.setClip(0, (int) yPos - charHeight, imgWidth - 1,
+              // If we're in an image export, set the clip width to be the
+              // entire width of the annotation.
+
+              int clipWidth = forExport
+                      ? row_annotations.length * charWidth - 1
+                      : imgWidth - 1;
+              g2dCopy.setClip(0, (int) yPos - charHeight, clipWidth,
                       charHeight);
               /*
                * translate to drawing position _before_ applying any scaling