git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2491 Tidies to Overview panel calls in light of new code
[jalview.git]
/
src
/
jalview
/
viewmodel
/
ViewportRanges.java
diff --git
a/src/jalview/viewmodel/ViewportRanges.java
b/src/jalview/viewmodel/ViewportRanges.java
index
267b50e
..
ac310cc
100644
(file)
--- a/
src/jalview/viewmodel/ViewportRanges.java
+++ b/
src/jalview/viewmodel/ViewportRanges.java
@@
-145,27
+145,38
@@
public class ViewportRanges extends ViewportProperties
*/
public void setEndRes(int res)
{
*/
public void setEndRes(int res)
{
+ int startres = res;
int width = getViewportWidth();
int width = getViewportWidth();
- setStartEndRes(res - width + 1, res);
+ if (startres + width - 1 > al.getWidth() - 1)
+ {
+ startres = al.getWidth() - width;
+ }
+ setStartEndRes(startres - width + 1, startres);
}
/**
}
/**
- * Set the first sequence visible in the viewport. Fires a property change
- * event.
+ * Set the first sequence visible in the viewport, maintaining the height. If
+ * the viewport would extend past the last sequence, sets the viewport so it
+ * sits at the bottom of the alignment. Fires a property change event.
*
* @param seq
* sequence position
*/
public void setStartSeq(int seq)
{
*
* @param seq
* sequence position
*/
public void setStartSeq(int seq)
{
+ int startseq = seq;
int height = getViewportHeight();
int height = getViewportHeight();
- setStartEndSeq(seq, seq + height - 1);
+ if (startseq + height - 1 > al.getHeight() - 1)
+ {
+ startseq = al.getHeight() - height;
+ }
+ setStartEndSeq(startseq, startseq + height - 1);
}
/**
}
/**
- * Set start and end sequences at the same time. This method only fires one
- * event for the two changes, and should be used in preference to separate
- * calls to setStartSeq and setEndSeq.
+ * Set start and end sequences at the same time. The viewport height may
+ * change. This method only fires one event for the two changes, and should be
+ * used in preference to separate calls to setStartSeq and setEndSeq.
*
* @param start
* the start sequence
*
* @param start
* the start sequence