JAL-2600 updates following review
[jalview.git] / src / jalview / gui / SeqCanvas.java
index 448dc6d..d8b3f2a 100755 (executable)
@@ -988,11 +988,12 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
   @Override
   public void propertyChange(PropertyChangeEvent evt)
   {
+    String eventName = evt.getPropertyName();
+
     if (!av.getWrapAlignment())
     {
       int scrollX = 0;
-      if ((evt.getPropertyName().equals("startres"))
-              || (evt.getPropertyName().equals("endres")))
+      if (eventName.equals(ViewportRanges.STARTRES))
       {
         // Make sure we're not trying to draw a panel
         // larger than the visible window
@@ -1008,26 +1009,21 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
         }
       }
 
-      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 (eventName.equals(ViewportRanges.STARTRES))
       {
         // scroll - startres and endres both change
         fastPaint(scrollX, 0);
       }
-      else if (evt.getPropertyName().equals("endres"))
-      {
-        // resize - only endres changes
-
-      }
-      else if (evt.getPropertyName().equals("startseq"))
+      else if (eventName.equals(ViewportRanges.STARTSEQ))
       {
         // scroll
         fastPaint(0, (int) evt.getNewValue() - (int) evt.getOldValue());
       }
-      else if (evt.getPropertyName().equals("endseq"))
-      {
-        // resize
-
-      }
     }
   }
 }