Merge branch 'develop' into doc/JAL-4090_Release_2_11_3_0
[jalview.git] / src / jalview / gui / IdCanvas.java
index aaded9e..2df84a9 100755 (executable)
@@ -199,7 +199,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI
 
     gg.translate(0, transY);
 
-    drawIds(gg, av, ss, es, searchResults,true);
+    drawIds(gg, av, ss, es, searchResults, true, getWidth());
 
     gg.translate(0, -transY);
 
@@ -256,7 +256,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI
     gg.fillRect(0, 0, getWidth(), imgHeight);
 
     drawIds(gg, av, av.getRanges().getStartSeq(),
-            av.getRanges().getEndSeq(), searchResults,true);
+            av.getRanges().getEndSeq(), searchResults,true, getWidth());
 
     gg.dispose();
 
@@ -274,9 +274,12 @@ public class IdCanvas extends JPanel implements ViewportListenerI
    * @param startSeq
    * @param endSeq
    * @param selection
+   * @param forGUI when false rendering for print
+   * @param panelWidth width used to calculate righthand margin - usually idCanvas.getWidth()
+   * 
    */
   void drawIds(Graphics2D g, AlignViewport alignViewport,
-          final int startSeq, final int endSeq, List<SequenceI> selection, boolean forGUI)
+          final int startSeq, final int endSeq, List<SequenceI> selection, boolean forGUI, int panelWidth)
   {
     Font font = alignViewport.getFont();
     if (alignViewport.isSeqNameItalics())
@@ -309,7 +312,6 @@ public class IdCanvas extends JPanel implements ViewportListenerI
     }
 
     // Now draw the id strings
-    int panelWidth = getWidth();
     int xPos = 0;
 
     // Now draw the id strings
@@ -454,7 +456,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI
         if (!manuallyAdjusted())
         {
           int getAnnotationsIdWidth = labels.drawLabels(g, false, -1, false,forGUI,
-                  null);
+                  null, false);
           thisIdWidth = idWidth < 0 ? getAnnotationsIdWidth : idWidth;
           if (thisIdWidth > getWidth)
           {