JAL-4367 Limit right and top adjustments
[jalview.git] / src / jalview / gui / AnnotationLabels.java
index 70fef2a..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)
       {