JAL-2491 First port to applet
[jalview.git] / src / jalview / appletgui / AlignViewport.java
index 951a651..13332d3 100644 (file)
@@ -39,6 +39,7 @@ import jalview.structure.SelectionSource;
 import jalview.structure.StructureSelectionManager;
 import jalview.structure.VamsasSource;
 import jalview.viewmodel.AlignmentViewport;
+import jalview.viewmodel.ViewportRanges;
 
 import java.awt.Font;
 
@@ -74,12 +75,10 @@ public class AlignViewport extends AlignmentViewport implements
     calculator = new jalview.workers.AlignCalcManager();
     this.applet = applet;
     alignment = al;
+    ranges = new ViewportRanges(this.alignment);
     // we always pad gaps
     this.setPadGaps(true);
-    this.startRes = 0;
-    this.endRes = al.getWidth() - 1;
-    this.startSeq = 0;
-    this.endSeq = al.getHeight() - 1;
+
     if (applet != null)
     {
       // get the width and height scaling factors if they were specified
@@ -298,7 +297,7 @@ public class AlignViewport extends AlignmentViewport implements
 
   public void resetSeqLimits(int height)
   {
-    setEndSeq(height / getCharHeight());
+    ranges.setEndSeq(height / getCharHeight());
   }
 
   public void setCurrentTree(NJTree tree)
@@ -439,8 +438,9 @@ public class AlignViewport extends AlignmentViewport implements
     int seqOffset = findComplementScrollTarget(sr);
     if (!sr.isEmpty())
     {
-      complementPanel.setFollowingComplementScroll(true);
+      complementPanel.setFollowingComplementScroll(false);
       complementPanel.scrollToCentre(sr, seqOffset);
+      complementPanel.setFollowingComplementScroll(true);
     }
   }