if (vertical > 0) // scroll down
{
- startSeq = endSeq - vertical;
+ startSeq = endSeq - vertical + 1;
if (startSeq < ranges.getStartSeq())
{ // ie scrolling too fast, more than a page at a time
}
else
{
- transY = img.getHeight() - ((vertical + 1) * charHeight);
+ transY = img.getHeight() - (vertical * charHeight);
}
}
- else if (vertical < 0)
+ else if (vertical < 0) // scroll up
{
- endSeq = startSeq - vertical;
+ endSeq = startSeq - vertical - 1;
if (endSeq > ranges.getEndSeq())
{
}
}
- // jalview.bin.Console.errPrintln(">>> FastPaint to " + transX + " " + transY + " "
+ // jalview.bin.Console.errPrintln(">>> FastPaint to " + transX + " " +
+ // transY + " "
// + horizontal + " " + vertical + " " + startRes + " " + endRes
// + " " + startSeq + " " + endSeq);
// Call repaint on alignment panel so that repaints from other alignment
// panel components can be aggregated. Otherwise performance of the
// overview window and others may be adversely affected.
- // jalview.bin.Console.outPrintln("SeqCanvas fastPaint() repaint() request...");
+ // jalview.bin.Console.outPrintln("SeqCanvas fastPaint() repaint()
+ // request...");
av.getAlignPanel().repaint();
} finally
{
if (av.getWrapAlignment())
{
- drawWrappedPanel(seqRdr, gg, getWidth(), getHeight(), ranges.getStartRes());
+ drawWrappedPanel(seqRdr, gg, getWidth(), getHeight(),
+ ranges.getStartRes());
}
else
{
- drawPanel(seqRdr,gg, startRes, endRes, startSeq, endSeq, 0);
+ drawPanel(seqRdr, gg, startRes, endRes, startSeq, endSeq, 0);
}
drawSelectionGroup(gg, startRes, endRes, startSeq, endSeq);
int startSeq, int endSeq)
{
SequenceRenderer localSeqR = new jalview.gui.SequenceRenderer(av);
- drawPanel(localSeqR,g1, startRes, endRes, startSeq, endSeq, 0);
+ drawPanel(localSeqR, g1, startRes, endRes, startSeq, endSeq, 0);
drawSelectionGroup((Graphics2D) g1, startRes, endRes, startSeq, endSeq);
}
* @param startColumn
* the first column (0...) of the alignment to draw
*/
- public void drawWrappedPanel(SequenceRenderer seqRdr, Graphics g, int canvasWidth,
- int canvasHeight, final int startColumn)
+ public void drawWrappedPanel(SequenceRenderer seqRdr, Graphics g,
+ int canvasWidth, int canvasHeight, final int startColumn)
{
int wrappedWidthInResidues = calculateWrappedGeometry(canvasWidth,
canvasHeight);
* @param endColumn
* @param canvasHeight
*/
- protected void drawWrappedWidth(SequenceRenderer seqRdr, Graphics g, final int ypos,
- final int startColumn, final int endColumn,
+ protected void drawWrappedWidth(SequenceRenderer seqRdr, Graphics g,
+ final int ypos, final int startColumn, final int endColumn,
final int canvasHeight)
{
ViewportRanges ranges = av.getRanges();
g.fillRect(0, ypos, (endx - startColumn + 1) * charWidth,
wrappedRepeatHeightPx);
- drawPanel(seqRdr, g, startColumn, endx, 0, av.getAlignment().getHeight() - 1,
- ypos);
+ drawPanel(seqRdr, g, startColumn, endx, 0,
+ av.getAlignment().getHeight() - 1, ypos);
int cHeight = av.getAlignment().getHeight() * av.getCharHeight();
* are hidden column markers in the visible region, then each sub-region
* between the markers is drawn separately, followed by the hidden column
* marker.
- * @param localSeqR - sequence renderer implementation - when null, uses the one used for rendering interactive GUI
+ *
+ * @param localSeqR
+ * - sequence renderer implementation - when null, uses the one used
+ * for rendering interactive GUI
*
* @param g1
* the graphics context, positioned at the first residue to be drawn
* @param yOffset
* vertical offset at which to draw (for wrapped alignments)
*/
- public void drawPanel(SequenceRenderer localSeqR, Graphics g1, final int startRes, final int endRes,
- final int startSeq, final int endSeq, final int yOffset)
+ public void drawPanel(SequenceRenderer localSeqR, Graphics g1,
+ final int startRes, final int endRes, final int startSeq,
+ final int endSeq, final int yOffset)
{
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
- if (localSeqR==null)
+ if (localSeqR == null)
{
localSeqR = seqRdr;
}
*/
g1.translate(screenY * charWidth, 0);
- draw(localSeqR, g1, blockStart, blockEnd, startSeq, endSeq, yOffset);
+ draw(localSeqR, g1, blockStart, blockEnd, startSeq, endSeq,
+ yOffset);
/*
* draw the downline of the hidden column marker (ScalePanel draws the
/**
* Draws a region of the visible alignment
- * @param seqRdr
+ *
+ * @param seqRdr
*
* @param g1
* @param startRes
* @param yOffset
* vertical offset at which to draw (for wrapped alignments)
*/
- private void draw(SequenceRenderer seqRdr, Graphics g, int startRes, int endRes, int startSeq,
- int endSeq, int offset)
+ private void draw(SequenceRenderer seqRdr, Graphics g, int startRes,
+ int endRes, int startSeq, int endSeq, int offset)
{
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
else if (inGroup)
{
drawVerticals(g, sx, xwidth, visWidth, oldY, bottom);
- drawHorizontals(g, sx, xwidth, visWidth, top, bottom+1);
+ drawHorizontals(g, sx, xwidth, visWidth, top, bottom);
// reset top and bottom
top = -1;
if (inGroup)
{
sy = verticalOffset + ((i - startSeq) * charHeight);
- drawVerticals(g, sx, xwidth, visWidth, oldY, bottom);
- drawHorizontals(g, sx, xwidth, visWidth, top, bottom+1);
+ drawVerticals(g, sx, xwidth, visWidth, oldY,
+ bottom == -1 ? sy : bottom);
+ drawHorizontals(g, sx, xwidth, visWidth, top, bottom);
}
}
}
public void propertyChange(PropertyChangeEvent evt)
{
String eventName = evt.getPropertyName();
- // jalview.bin.Console.errPrintln(">>SeqCanvas propertyChange " + eventName);
+ // jalview.bin.Console.errPrintln(">>SeqCanvas propertyChange " +
+ // eventName);
if (eventName.equals(SequenceGroup.SEQ_GROUP_CHANGED))
{
fastPaint = true;
else if (eventName.equals(ViewportRanges.MOVE_VIEWPORT))
{
fastPaint = false;
- // jalview.bin.Console.errPrintln("!!!! fastPaint false from MOVE_VIEWPORT");
+ // jalview.bin.Console.errPrintln("!!!! fastPaint false from
+ // MOVE_VIEWPORT");
repaint();
return;
}
if (scrollX < 0)
{
int startRes = ranges.getStartRes();
- drawWrappedWidth(seqRdr,gg, wrappedSpaceAboveAlignment, startRes,
+ drawWrappedWidth(seqRdr, gg, wrappedSpaceAboveAlignment, startRes,
startRes - scrollX - 1, getHeight());
}
else
{
matchFound = true;
gg.translate(transX, transY);
- drawPanel(seqRdr,gg, displayColumn, displayColumn, seqNo, seqNo,
- yOffset);
+ drawPanel(seqRdr, gg, displayColumn, displayColumn, seqNo,
+ seqNo, yOffset);
gg.translate(-transX, -transY);
}
}