X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FScalePanel.java;h=9add7478d65d0cddd5db0b3eb0b04a7b55bde202;hb=52fd681e0f239e20df19fd7560d4b999104ba222;hp=8f32d8cf164aa77ffbaa9f8cbf85899383d1a146;hpb=14bad6b2390493bb6ad030c6f3ea7cde4cba1b53;p=jalview.git diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 8f32d8c..9add747 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -167,6 +167,11 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); + if(res> av.alignment.getWidth()) + { + res = av.alignment.getWidth()-1; + } + if(av.hasHiddenColumns) res = av.getColumnSelection().adjustForHiddenColumns(res); @@ -206,6 +211,12 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList if(av.hasHiddenColumns) res = av.getColumnSelection().adjustForHiddenColumns(res); + + if(res> av.alignment.getWidth()) + { + res = av.alignment.getWidth()-1; + } + if (res < min) { min = res; @@ -217,6 +228,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList } + + SequenceGroup sg = av.getSelectionGroup(); if (sg != null) @@ -353,16 +366,27 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList scalestartx += 5; } + String string; + int maxX=0; + for (int i = scalestartx; i < endx; i += 5) { if ((i % 10) == 0) { - gg.drawString(String.valueOf(av.getColumnSelection().adjustForHiddenColumns(i)), - (i - startx - 1) * av.charWidth, y); - 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)); + string = String.valueOf(av.getColumnSelection().adjustForHiddenColumns(i)); + if ( (i - startx - 1) * av.charWidth > maxX) + { + gg.drawString(string, + (i - startx - 1) * av.charWidth, y); + 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)); + } else {