- int offy = vscroll.getValue();
- int rowSize = getSeqPanel().seqCanvas
- .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth());
-
- // 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
- int newX = offy * rowSize;
- newX += oldX % rowSize; // horizontal scroll offset if any
- if ((newX == oldX) && (oldwidth == rowSize))
- {
- return;
- }
- else if (offy > -1)
- {
- // limit page up/down to one width's worth of positions
- newX = newX > oldX ? oldX + rowSize : oldX - rowSize;
- vpRanges.setViewportStartAndWidth(newX, rowSize);
- }
- }
- else
- {
- // This is only called if file loaded is a jar file that
- // was wrapped when saved and user has wrap alignment true
- // as preference setting
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- // When updating scrolling to use ViewportChange events, this code
- // could not be validated and it is not clear if it is now being
- // called. Log warning here in case it is called and unforeseen
- // problems occur
- Cache.log
- .warn("Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences");
-
- // scroll to start of panel
- vpRanges.setStartRes(0);
- vpRanges.setStartSeq(0);
- }
- });