Merge branch 'bug/JAL-4290_headless_alignment_export_with_structure_annotations_doesn...
[jalview.git] / src / jalview / gui / AnnotationLabels.java
index 94f8790..7c5afcd 100755 (executable)
@@ -793,9 +793,15 @@ public class AnnotationLabels extends JPanel
     {
       Dimension d = ap.annotationScroller.getPreferredSize();
       int dif = evt.getY() - oldY;
+      dif -= dif % ap.av.getCharHeight();
 
-      dif /= ap.av.getCharHeight();
-      dif *= ap.av.getCharHeight();
+      // don't allow setting an annotation panel height larger than visible
+      // (otherwise you can't get back)
+      if (d.height - dif > ap.idPanelHolder.getHeight()
+              - ap.getIdSpaceFillerPanel1().getHeight())
+      {
+        return;
+      }
 
       if ((d.height - dif) > 20)
       {
@@ -1206,8 +1212,8 @@ public class AnnotationLabels extends JPanel
     if (ap != null)
     {
       iwa = ap.idwidthAdjuster;
-      if ((Cache.getDefault(ADJUST_ANNOTATION_LABELS_WIDTH_PREF, true)
-              || Jalview.isHeadlessMode()))
+      if (Cache.getDefault(ADJUST_ANNOTATION_LABELS_WIDTH_PREF, true)
+              || Jalview.isHeadlessMode())
       {
         Graphics2D g2d = (Graphics2D) g;
         Graphics dummy = g2d.create();