X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FScalePanel.java;h=86884862a9d994a9f65e56e1ceb215d672042608;hb=9c1232ed2d632dd4968e407a6c9aa3e2beb6bacf;hp=af226f3e0a96a267812213f787c789a1ca8e58ea;hpb=4ebc6d5b362bc093c39312aa1a69836e3dd6ae84;p=jalview.git diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index af226f3..8688486 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -71,6 +71,7 @@ public class ScalePanel int res = x / av.getCharWidth() + av.getStartRes(); SequenceGroup sg = null; + if (av.getColumnSelection().contains(res)) { av.getColumnSelection().removeElement(res); @@ -104,6 +105,11 @@ public class ScalePanel int x = evt.getX(); int res = x / av.getCharWidth() + av.getStartRes(); + if(res> av.alignment.getWidth()) + { + res = av.alignment.getWidth()-1; + } + if (!av.getColumnSelection().contains(res)) { av.getColumnSelection().addElement(res); @@ -129,6 +135,11 @@ public class ScalePanel int x = evt.getX(); int res = x / av.getCharWidth() + av.getStartRes(); + if(res> av.alignment.getWidth()) + { + res = av.alignment.getWidth()-1; + } + SequenceGroup sg = av.getSelectionGroup(); if (sg != null) { @@ -194,11 +205,21 @@ public class ScalePanel scalestartx += 5; } + String string; + int maxX=0; + for (int i = scalestartx; i < endx; i += 5) { if (i % 10 == 0) { - gg.drawString(String.valueOf(i), (i - startx - 1) * av.charWidth, y); + string = String.valueOf(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),