git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
507114c
)
JAL-4289 In fastPaint(), don't render one more than necessary sequence when scrolling...
author
Ben Soares
<b.soares@dundee.ac.uk>
Mon, 2 Oct 2023 19:15:30 +0000
(20:15 +0100)
committer
Ben Soares
<b.soares@dundee.ac.uk>
Mon, 2 Oct 2023 19:15:30 +0000
(20:15 +0100)
src/jalview/gui/SeqCanvas.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/SeqCanvas.java
b/src/jalview/gui/SeqCanvas.java
index
537af58
..
a9bfbf6
100755
(executable)
--- a/
src/jalview/gui/SeqCanvas.java
+++ b/
src/jalview/gui/SeqCanvas.java
@@
-323,7
+323,7
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
if (vertical > 0) // scroll down
{
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
if (startSeq < ranges.getStartSeq())
{ // ie scrolling too fast, more than a page at a time
@@
-331,12
+331,12
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
}
else
{
}
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())
{
if (endSeq > ranges.getEndSeq())
{
@@
-344,7
+344,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
}
}
}
}
- // jalview.bin.Console.errPrintln(">>> FastPaint to " + transX + " " + transY + " "
+ // jalview.bin.Console.errPrintln(">>> FastPaint to " + transX + " " +
+ // transY + " "
// + horizontal + " " + vertical + " " + startRes + " " + endRes
// + " " + startSeq + " " + endSeq);
// + horizontal + " " + vertical + " " + startRes + " " + endRes
// + " " + startSeq + " " + endSeq);
@@
-363,7
+364,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
// 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.
// 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
{
av.getAlignPanel().repaint();
} finally
{
@@
-456,11
+458,12
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
if (av.getWrapAlignment())
{
if (av.getWrapAlignment())
{
- drawWrappedPanel(seqRdr, gg, getWidth(), getHeight(), ranges.getStartRes());
+ drawWrappedPanel(seqRdr, gg, getWidth(), getHeight(),
+ ranges.getStartRes());
}
else
{
}
else
{
- drawPanel(seqRdr,gg, startRes, endRes, startSeq, endSeq, 0);
+ drawPanel(seqRdr, gg, startRes, endRes, startSeq, endSeq, 0);
}
drawSelectionGroup(gg, startRes, endRes, startSeq, endSeq);
}
drawSelectionGroup(gg, startRes, endRes, startSeq, endSeq);
@@
-493,7
+496,7
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
int startSeq, int endSeq)
{
SequenceRenderer localSeqR = new jalview.gui.SequenceRenderer(av);
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);
}
drawSelectionGroup((Graphics2D) g1, startRes, endRes, startSeq, endSeq);
}
@@
-611,8
+614,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
* @param startColumn
* the first column (0...) of the alignment to draw
*/
* @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);
{
int wrappedWidthInResidues = calculateWrappedGeometry(canvasWidth,
canvasHeight);
@@
-733,8
+736,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
* @param endColumn
* @param 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();
final int canvasHeight)
{
ViewportRanges ranges = av.getRanges();
@@
-762,8
+765,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
g.fillRect(0, ypos, (endx - startColumn + 1) * charWidth,
wrappedRepeatHeightPx);
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();
int cHeight = av.getAlignment().getHeight() * av.getCharHeight();
@@
-966,7
+969,10
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
* are hidden column markers in the visible region, then each sub-region
* between the markers is drawn separately, followed by the hidden column
* marker.
* 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 g1
* the graphics context, positioned at the first residue to be drawn
@@
-981,13
+987,14
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
* @param yOffset
* vertical offset at which to draw (for wrapped alignments)
*/
* @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();
{
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
- if (localSeqR==null)
+ if (localSeqR == null)
{
localSeqR = seqRdr;
}
{
localSeqR = seqRdr;
}
@@
-1017,7
+1024,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
*/
g1.translate(screenY * charWidth, 0);
*/
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
/*
* draw the downline of the hidden column marker (ScalePanel draws the
@@
-1042,7
+1050,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
/**
* Draws a region of the visible alignment
/**
* Draws a region of the visible alignment
- * @param seqRdr
+ *
+ * @param seqRdr
*
* @param g1
* @param startRes
*
* @param g1
* @param startRes
@@
-1056,8
+1065,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
* @param yOffset
* vertical offset at which to draw (for wrapped alignments)
*/
* @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();
{
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
@@
-1399,7
+1408,7
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
else if (inGroup)
{
drawVerticals(g, sx, xwidth, visWidth, oldY, bottom);
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;
// reset top and bottom
top = -1;
@@
-1410,8
+1419,9
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
if (inGroup)
{
sy = verticalOffset + ((i - startSeq) * charHeight);
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);
}
}
}
}
}
}
@@
-1688,7
+1698,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
public void propertyChange(PropertyChangeEvent evt)
{
String eventName = evt.getPropertyName();
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;
if (eventName.equals(SequenceGroup.SEQ_GROUP_CHANGED))
{
fastPaint = true;
@@
-1698,7
+1709,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
else if (eventName.equals(ViewportRanges.MOVE_VIEWPORT))
{
fastPaint = false;
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;
}
repaint();
return;
}
@@
-1828,7
+1840,7
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
if (scrollX < 0)
{
int startRes = ranges.getStartRes();
if (scrollX < 0)
{
int startRes = ranges.getStartRes();
- drawWrappedWidth(seqRdr,gg, wrappedSpaceAboveAlignment, startRes,
+ drawWrappedWidth(seqRdr, gg, wrappedSpaceAboveAlignment, startRes,
startRes - scrollX - 1, getHeight());
}
else
startRes - scrollX - 1, getHeight());
}
else
@@
-2156,8
+2168,8
@@
public class SeqCanvas extends JPanel implements ViewportListenerI
{
matchFound = true;
gg.translate(transX, transY);
{
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);
}
}
gg.translate(-transX, -transY);
}
}