JAL-2600 updates following review
[jalview.git] / src / jalview / gui / AnnotationPanel.java
index c688789..61099c3 100755 (executable)
@@ -31,6 +31,7 @@ import jalview.schemes.ResidueProperties;
 import jalview.util.Comparison;
 import jalview.util.MessageManager;
 import jalview.viewmodel.ViewportListenerI;
+import jalview.viewmodel.ViewportRanges;
 
 import java.awt.AlphaComposite;
 import java.awt.Color;
@@ -981,13 +982,15 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       repaint();
       return;
     }
+
+    int sr = av.getRanges().getStartRes();
+    int er = av.getRanges().getEndRes() + 1;
+    int transX = 0;
+
     long stime = System.currentTimeMillis();
     gg.copyArea(0, 0, imgWidth, getHeight(),
             -horizontal * av.getCharWidth(), 0);
     long mtime = System.currentTimeMillis();
-    int sr = av.getRanges().getStartRes();
-    int er = av.getRanges().getEndRes() + 1;
-    int transX = 0;
 
     if (horizontal > 0) // scrollbar pulled right, image to the left
     {
@@ -1168,13 +1171,14 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   public void propertyChange(PropertyChangeEvent evt)
   {
     // Respond to viewport range changes (e.g. alignment panel was scrolled)
-    if (evt.getPropertyName().equals("startres"))
+    // Both scrolling and resizing change viewport ranges: scrolling changes
+    // both start and end points, but resize only changes end values.
+    // Here we only want to fastpaint on a scroll, with resize using a normal
+    // paint, so scroll events are identified as changes to the horizontal or
+    // vertical start value.
+    if (evt.getPropertyName().equals(ViewportRanges.STARTRES))
     {
       fastPaint((int) evt.getNewValue() - (int) evt.getOldValue());
     }
-    else if (evt.getPropertyName().equals("endres"))
-    {
-      // resize
-    }
   }
 }