{
int offset = (vpRanges.getEndRes() - vpRanges.getStartRes() + 1) / 2 - 1;
start = Math.max(start - offset, 0);
- end = Math.min(end + offset, seq.getEnd() - 1);
+ end = end + offset - 1;
+ // end = Math.min(end + offset, seq.getEnd() - 1);
}
if (start < 0)
int start = -1;
if (av.hasHiddenColumns())
{
- start = av.getColumnSelection().findColumnPosition(ostart);
- end = av.getColumnSelection().findColumnPosition(end);
+ AlignmentI al = av.getAlignment();
+ start = al.getHiddenColumns().findColumnPosition(ostart);
+ end = al.getHiddenColumns().findColumnPosition(end);
if (start == end)
{
- if (!scrollToNearest && !av.getColumnSelection().isVisible(ostart))
+ if (!scrollToNearest && !al.getHiddenColumns().isVisible(ostart))
{
// don't scroll - position isn't visible
return false;
int vextent = 0;
- public void setScrollValues(int x, int y)
+ public void setScrollValues(int xpos, int ypos)
{
+ int x = xpos;
+ int y = ypos;
+
if (av.getWrapAlignment())
{
setScrollingForWrappedPanel(x);
}
else
{
-
int width = av.getAlignment().getWidth();
int height = av.getAlignment().getHeight();
if (av.hasHiddenColumns())
{
- width = av.getColumnSelection().findColumnPosition(width);
+ width = av.getAlignment().getHiddenColumns()
+ .findColumnPosition(width);
}
if (x < 0)
{
}
}
+ /**
+ * Respond to adjustment event when horizontal or vertical scrollbar is
+ * changed
+ *
+ * @param evt
+ * adjustment event encoding whether apvscroll, hscroll or vscroll
+ * changed
+ */
@Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
+ // Note that this event is NOT fired by the AWT scrollbar when setValues is
+ // called. Instead manually call adjustHorizontal and adjustVertical
+ // directly.
if (evt == null || evt.getSource() == apvscroll)
{
annotationPanel.setScrollOffset(apvscroll.getValue(), false);
// if we're scrolling to the position we're already at, stop
// this prevents infinite recursion of events when the scroll/viewport
// ranges values are the same
- if ((offy * rowSize == oldX) && (oldwidth == rowSize))
+ int newX = offy * rowSize;
+ newX += oldX % rowSize; // horizontal scroll offset if any
+ if ((newX == oldX) && (oldwidth == rowSize))
{
return;
}
else if (offy > -1)
{
- vpRanges.setViewportStartAndWidth(offy * rowSize, rowSize);
+ // limit page up/down to one width's worth of positions
+ newX = newX > oldX ? oldX + rowSize : oldX - rowSize;
+ vpRanges.setViewportStartAndWidth(newX, rowSize);
}
}
else
* Scroll to position but centring the target residue. Also set a state flag
* to prevent adjustmentValueChanged performing this recursively.
*/
- // setFollowingComplementScroll(true);
- // this should be scrollToPosition(sr,verticalOffset,
scrollToPosition(sr, seqOffset, true, true);
}
int maxwidth = av.getAlignment().getWidth();
if (av.hasHiddenColumns())
{
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
+ maxwidth = av.getAlignment().getHiddenColumns()
+ .findColumnPosition(maxwidth) - 1;
}
// get the width of the canvas in residues
this.scrollComplementaryPanel = b;
}
+ /**
+ * Get whether to scroll complement panel
+ *
+ * @return true if cDNA/protein complement panels should be scrolled
+ */
protected boolean isSetToScrollComplementPanel()
{
return this.scrollComplementaryPanel;