From: Ben Soares Date: Wed, 20 Dec 2023 13:23:07 +0000 (+0000) Subject: JAL-4367 Limit right and top adjustments X-Git-Tag: Release_2_11_4_0~49^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ea920b2f6a5fb611397ec1fd51bc12402c5a8d09;p=jalview.git JAL-4367 Limit right and top adjustments --- diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 70fef2a..7c5afcd 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -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) { diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index 99a39d4..029f184 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -132,7 +132,7 @@ public class IdwidthAdjuster extends JPanel /* * don't drag below minimum width */ - if (newWidth < MIN_ID_WIDTH) + if (newWidth < MIN_ID_WIDTH || newWidth > this.ap.getWidth()) { return; } diff --git a/src/jalview/jbgui/GAlignmentPanel.java b/src/jalview/jbgui/GAlignmentPanel.java index 2f0c75e..2d6f569 100755 --- a/src/jalview/jbgui/GAlignmentPanel.java +++ b/src/jalview/jbgui/GAlignmentPanel.java @@ -145,4 +145,9 @@ public class GAlignmentPanel extends JPanel hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST); this.add(sequenceHolderPanel, BorderLayout.CENTER); } + + public JPanel getIdSpaceFillerPanel1() + { + return idSpaceFillerPanel1; + } }