JAL-3446 from applet; JAL-3374
[jalview.git] / src / jalview / viewmodel / ViewportRanges.java
index 4f671da..5a4fc57 100644 (file)
@@ -136,13 +136,25 @@ public class ViewportRanges extends ViewportProperties
     int[] oldvalues = updateStartEndRes(start, end);
     int oldstartres = oldvalues[0];
     int oldendres = oldvalues[1];
+    
+    if (oldstartres == startRes && oldendres == endRes)
+    {
+      return; // BH 2019.07.27 standard check for no changes
+    }
 
+    // "STARTRES" is a misnomer here -- really "STARTORENDRES"
+    // note that this could be "no change" if the range is just being expanded
     changeSupport.firePropertyChange(STARTRES, oldstartres, startRes);
     if (oldstartres == startRes)
     {
+      // only caught in ViewportRangesTest
+      // No listener cares about this
+      // "ENDRES" is a misnomer here -- really "ENDONLYRES"
+      // BH 2019.07.27 adds end change check
+      // fire only if only the end is changed
       // event won't be fired if start positions are same
       // fire an event for the end positions in case they changed
-      changeSupport.firePropertyChange(ENDRES, oldendres, endRes);
+     changeSupport.firePropertyChange(ENDRES, oldendres, endRes);
     }
   }
 
@@ -797,4 +809,10 @@ public class ViewportRanges extends ViewportProperties
 
     return maxScroll;
   }
+  
+
+  @Override
+  public String toString() {
+     return "[ViewportRange " + startSeq + "-" + endSeq + ", "+ startRes + "-" + endRes + "]";
+  }
 }