git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-1889 remove debug logging, add updateLayout()
[jalview.git]
/
src
/
jalview
/
gui
/
SeqCanvas.java
diff --git
a/src/jalview/gui/SeqCanvas.java
b/src/jalview/gui/SeqCanvas.java
index
64d681b
..
b3fcc54
100755
(executable)
--- a/
src/jalview/gui/SeqCanvas.java
+++ b/
src/jalview/gui/SeqCanvas.java
@@
-55,6
+55,11
@@
import javax.swing.JComponent;
*/
public class SeqCanvas extends JComponent implements ViewportListenerI
{
*/
public class SeqCanvas extends JComponent implements ViewportListenerI
{
+ /*
+ * pixels gap between sequences and annotations when in wrapped mode
+ */
+ static final int SEQS_ANNOTATION_GAP = 3;
+
private static final String ZEROS = "0000000000";
final FeatureRenderer fr;
private static final String ZEROS = "0000000000";
final FeatureRenderer fr;
@@
-82,9
+87,9
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
private int labelWidthWest; // label left width in pixels if shown
private int labelWidthWest; // label left width in pixels if shown
- private int wrappedSpaceAboveAlignment; // gap between widths
+ int wrappedSpaceAboveAlignment; // gap between widths
- private int wrappedRepeatHeightPx; // height in pixels of wrapped width
+ int wrappedRepeatHeightPx; // height in pixels of wrapped width
private int wrappedVisibleWidths; // number of wrapped widths displayed
private int wrappedVisibleWidths; // number of wrapped widths displayed
@@
-364,10
+369,6
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
width -= (width % charWidth);
height -= (height % charHeight);
width -= (width % charWidth);
height -= (height % charHeight);
- drawSelectionGroup((Graphics2D) g,
- ranges.getStartRes(), ranges.getEndRes(),
- ranges.getStartSeq(), ranges.getEndSeq());
-
if ((img != null) && (fastPaint
|| (getVisibleRect().width != g.getClipBounds().width)
|| (getVisibleRect().height != g.getClipBounds().height)))
if ((img != null) && (fastPaint
|| (getVisibleRect().width != g.getClipBounds().width)
|| (getVisibleRect().height != g.getClipBounds().height)))
@@
-563,7
+564,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
calculateWrappedGeometry(canvasWidth, canvasHeight);
/*
calculateWrappedGeometry(canvasWidth, canvasHeight);
/*
- * draw one width at a time (excluding any scales or annotation shown),
+ * draw one width at a time (excluding any scales shown),
* until we have run out of either alignment or vertical space available
*/
int ypos = wrappedSpaceAboveAlignment;
* until we have run out of either alignment or vertical space available
*/
int ypos = wrappedSpaceAboveAlignment;
@@
-610,14
+611,22
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
* (av.getScaleAboveWrapped() ? 2 : 1);
/*
* (av.getScaleAboveWrapped() ? 2 : 1);
/*
- * height in pixels of the wrapped widths
+ * compute height in pixels of the wrapped widths
+ * - start with space above plus sequences
*/
wrappedRepeatHeightPx = wrappedSpaceAboveAlignment;
*/
wrappedRepeatHeightPx = wrappedSpaceAboveAlignment;
- // add sequences
wrappedRepeatHeightPx += av.getAlignment().getHeight()
* charHeight;
wrappedRepeatHeightPx += av.getAlignment().getHeight()
* charHeight;
- // add annotations panel height if shown
- wrappedRepeatHeightPx += getAnnotationHeight();
+
+ /*
+ * add annotations panel height if shown
+ * also gap between sequences and annotations
+ */
+ if (av.isShowAnnotation())
+ {
+ wrappedRepeatHeightPx += getAnnotationHeight();
+ wrappedRepeatHeightPx += SEQS_ANNOTATION_GAP; // 3px
+ }
/*
* number of visible widths (the last one may be part height),
/*
* number of visible widths (the last one may be part height),
@@
-661,8
+670,9
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
* @param endColumn
* @param canvasHeight
*/
* @param endColumn
* @param canvasHeight
*/
- protected void drawWrappedWidth(Graphics g, int ypos, int startColumn,
- int endColumn, int canvasHeight)
+ protected void drawWrappedWidth(Graphics g, final int ypos,
+ final int startColumn, final int endColumn,
+ final int canvasHeight)
{
ViewportRanges ranges = av.getRanges();
int viewportWidth = ranges.getViewportWidth();
{
ViewportRanges ranges = av.getRanges();
int viewportWidth = ranges.getViewportWidth();
@@
-709,7
+719,8
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
if (av.isShowAnnotation())
{
if (av.isShowAnnotation())
{
- g.translate(0, cHeight + ypos + 3);
+ final int yShift = cHeight + ypos + SEQS_ANNOTATION_GAP;
+ g.translate(0, yShift);
if (annotations == null)
{
annotations = new AnnotationPanel(av);
if (annotations == null)
{
annotations = new AnnotationPanel(av);
@@
-717,7
+728,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
annotations.renderer.drawComponent(annotations, av, g, -1,
startColumn, endx + 1);
annotations.renderer.drawComponent(annotations, av, g, -1,
startColumn, endx + 1);
- g.translate(0, -cHeight - ypos - 3);
+ g.translate(0, -yShift);
}
g.setClip(clip);
g.translate(-xOffset, 0);
}
g.setClip(clip);
g.translate(-xOffset, 0);
@@
-859,13
+870,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
int startx = startRes;
int endx;
int ypos = hgap; // vertical offset
int startx = startRes;
int endx;
int ypos = hgap; // vertical offset
- int maxwidth = av.getAlignment().getWidth();
-
- if (av.hasHiddenColumns())
- {
- maxwidth = av.getAlignment().getHiddenColumns()
- .absoluteToVisibleColumn(maxwidth);
- }
+ int maxwidth = av.getAlignment().getVisibleWidth();
// chop the wrapped alignment extent up into panel-sized blocks and treat
// each block as if it were a block from an unwrapped alignment
// chop the wrapped alignment extent up into panel-sized blocks and treat
// each block as if it were a block from an unwrapped alignment
@@
-1091,10
+1096,10
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
if (group != null)
{
if (group != null)
{
- g.setColor(group.getOutlineColour());
-
do
{
do
{
+ g.setColor(group.getOutlineColour());
+
drawPartialGroupOutline(g, group, startRes, endRes, startSeq,
endSeq, offset);
drawPartialGroupOutline(g, group, startRes, endRes, startSeq,
endSeq, offset);
@@
-1650,7
+1655,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
}
ViewportRanges vpRanges = av.getRanges();
}
ViewportRanges vpRanges = av.getRanges();
- int range = vpRanges.getEndRes() - vpRanges.getStartRes();
+ int range = vpRanges.getEndRes() - vpRanges.getStartRes() + 1;
if (scrollX > range)
{
scrollX = range;
if (scrollX > range)
{
scrollX = range;
@@
-1719,10
+1724,10
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
{
ViewportRanges ranges = av.getRanges();
{
ViewportRanges ranges = av.getRanges();
- if (Math.abs(scrollX) > ranges.getViewportWidth())
+ if (Math.abs(scrollX) >= ranges.getViewportWidth())
{
/*
{
/*
- * shift of more than one view width is
+ * shift of one view width or more is
* overcomplicated to handle in this method
*/
fastPaint = false;
* overcomplicated to handle in this method
*/
fastPaint = false;
@@
-1913,10
+1918,17
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
while (y >= 0)
{
while (y >= 0)
{
+ /*
+ * shift 'widthToCopy' residues by 'positions' places to the right
+ */
gg.copyArea(copyFromLeftStart, y, widthToCopy, heightToCopy,
positions * charWidth, 0);
if (y > 0)
{
gg.copyArea(copyFromLeftStart, y, widthToCopy, heightToCopy,
positions * charWidth, 0);
if (y > 0)
{
+ /*
+ * copy 'positions' residue from the row above (right hand end)
+ * to this row's left hand end
+ */
gg.copyArea(copyFromRightStart, y - wrappedRepeatHeightPx,
positions * charWidth, heightToCopy, -widthToCopy,
wrappedRepeatHeightPx);
gg.copyArea(copyFromRightStart, y - wrappedRepeatHeightPx,
positions * charWidth, heightToCopy, -widthToCopy,
wrappedRepeatHeightPx);