JAL-4260 attempt to rejig paging when id width is adjusted whilst in wrapped mode.
authorJames Procter <j.procter@dundee.ac.uk>
Wed, 6 Sep 2023 14:28:14 +0000 (15:28 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Wed, 6 Sep 2023 14:28:14 +0000 (15:28 +0100)
src/jalview/gui/IdwidthAdjuster.java

index 4596e1f..762612e 100755 (executable)
@@ -158,10 +158,21 @@ public class IdwidthAdjuster extends JPanel
     {
       return;
     }
+    
+    // TODO JAL-4260 - work out how to trigger recomputation of wrapped pages !
+    int curCol = viewport.getRanges().getStartRes()
+            + viewport.getRanges().getViewportWidth();
+    
     viewport.setIdWidth(newWidth);
+
     ap.validateAnnotationDimensions(false);
+    if (viewport.getWrapAlignment())
+    {
+      viewport.getRanges().scrollToWrappedVisible(
+              curCol - viewport.getRanges().getViewportWidth());
+    }
     ap.paintAlignment(true, false);
-
+    
     ap.getIdPanel().getIdCanvas().setManuallyAdjusted(true);
   }