seqs, 0, viewport.getAlignment().getWidth(),
viewport.getAlignment()));
- viewport.getRanges().setEndSeq(viewport.getAlignment().getHeight());
+ viewport.getRanges().setEndSeq(viewport.getAlignment().getHeight() - 1); // BH
+ // 2019.04.18
viewport.getAlignment().getWidth();
viewport.firePropertyChange("alignment", null,
viewport.getAlignment().getSequences());
*/
public void setStartEndSeq(int start, int end)
{
+ // System.out.println("ViewportRange setStartEndSeq " + start + " " + end);
int[] oldvalues = updateStartEndSeq(start, end);
int oldstartseq = oldvalues[0];
int oldendseq = oldvalues[1];
* event.
*
* @param seq
- * sequence position
+ * sequence position in the range [0, height)
*/
public void setEndSeq(int seq)
{
- int height = getViewportHeight();
- setStartEndSeq(seq - height + 1, seq);
+ // BH 2018.04.18 added safety for seq < 0; comment about not being >= height
+ setStartEndSeq(Math.max(0, seq + 1 - getViewportHeight()), seq);
}
/**
public void setViewportStartAndHeight(int start, int h)
{
int vpstart = start;
+
+ int visHeight = getVisibleAlignmentHeight();
if (vpstart < 0)
{
vpstart = 0;
}
- else if ((h <= getVisibleAlignmentHeight())
- && (vpstart + h - 1 > getVisibleAlignmentHeight() - 1))
+ else if (h <= visHeight && vpstart + h > visHeight)
// viewport height is less than the full alignment and we are running off
// the bottom
{
- vpstart = getVisibleAlignmentHeight() - h;
+ vpstart = visHeight - h;
}
+ // System.out.println("ViewportRanges setviewportStartAndHeight " + vpstart
+ // + " " + start + " " + h + " " + getVisibleAlignmentHeight());
+
setStartEndSeq(vpstart, vpstart + h - 1);
}