X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FScalePanel.java;h=c50330b93a5b0700def7f4988f8cdf8eeec38b5e;hb=7c28880430765f06ccd5ec8ad3caf17871336e97;hp=2acd92cd3595e3e6766800772196bac042bec801;hpb=d423f22792e47dbc800ae220a58677f988971d06;p=jalview.git diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 2acd92c..c50330b 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -1,5 +1,5 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * * This file is part of Jalview. @@ -72,7 +72,12 @@ public class ScalePanel extends JPanel implements MouseMotionListener, if (av.hasHiddenColumns) { - res = av.getColumnSelection().adjustForHiddenColumns(x); + x = av.getColumnSelection().adjustForHiddenColumns(x); + } + + if (x >= av.alignment.getWidth()) + { + res = av.alignment.getWidth() - 1; } else { @@ -169,7 +174,6 @@ public class ScalePanel extends JPanel implements MouseMotionListener, iVec = null; sg.setStartRes(res); sg.setEndRes(res); - av.setSelectionGroup(sg); if (evt.isShiftDown()) { @@ -182,7 +186,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, sg.setStartRes(min); sg.setEndRes(max); } - + av.setSelectionGroup(sg); } ap.paintAlignment(false); @@ -201,14 +205,14 @@ public class ScalePanel extends JPanel implements MouseMotionListener, int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - if (res > av.alignment.getWidth()) + if (av.hasHiddenColumns) { - res = av.alignment.getWidth() - 1; + res = av.getColumnSelection().adjustForHiddenColumns(res); } - if (av.hasHiddenColumns) + if (res >= av.alignment.getWidth()) { - res = av.getColumnSelection().adjustForHiddenColumns(res); + res = av.alignment.getWidth() - 1; } if (!stretchingGroup) @@ -257,7 +261,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, res = av.getColumnSelection().adjustForHiddenColumns(res); } - if (res > av.alignment.getWidth()) + if (res >= av.alignment.getWidth()) { res = av.alignment.getWidth() - 1; } @@ -295,7 +299,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, int col; for (int i = min; i <= max; i++) { - col = av.getColumnSelection().adjustForHiddenColumns(i); + col = i; // av.getColumnSelection().adjustForHiddenColumns(i); if ((col < sg.getStartRes()) || (col > sg.getEndRes())) { @@ -351,8 +355,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, { reveal = region; ToolTipManager.sharedInstance().registerComponent(this); - this - .setToolTipText("Reveal Hidden Columns with Right Mouse Button"); + this.setToolTipText("Reveal Hidden Columns with Right Mouse Button"); break; } else @@ -398,6 +401,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, // Fill the selected columns ColumnSelection cs = av.getColumnSelection(); + int s; if (cs != null) { gg.setColor(new Color(220, 0, 0)); @@ -407,7 +411,14 @@ public class ScalePanel extends JPanel implements MouseMotionListener, int sel = cs.columnAt(i); if (av.hasHiddenColumns) { - sel = cs.findColumnPosition(sel); + if (cs.isVisible(sel)) + { + sel = cs.findColumnPosition(sel); + } + else + { + continue; + } } if ((sel >= startx) && (sel <= endx)) @@ -445,22 +456,20 @@ public class ScalePanel extends JPanel implements MouseMotionListener, maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string); } - gg - .drawLine( - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), - y + 2, - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), - y + (fm.getDescent() * 2)); + gg.drawLine( + (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + y + 2, + (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + y + (fm.getDescent() * 2)); } else { - gg - .drawLine( - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), - y + fm.getDescent(), - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), - y + (fm.getDescent() * 2)); + gg.drawLine( + (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + y + fm.getDescent(), + (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + y + (fm.getDescent() * 2)); } }