From: Jim Procter Date: Fri, 6 May 2016 14:29:14 +0000 (+0100) Subject: JAL-192 JAL-2099 reuse refactored scale code for wrapped view X-Git-Tag: Release_2_10_0~227^2~2^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=af9772ad2e3c28a8f075ace5c97ec1f863f96726;p=jalview.git JAL-192 JAL-2099 reuse refactored scale code for wrapped view --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 0f24b4b..2f7cd76 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -122,24 +122,26 @@ public class SeqCanvas extends JComponent private void drawNorthScale(Graphics g, int startx, int endx, int ypos) { updateViewport(); - int scalestartx = startx - (startx % 10) + 10; - - g.setColor(Color.black); - // NORTH SCALE - for (int i = scalestartx; i < endx; i += 10) + for (Object[] mark : jalview.renderer.ScaleRenderer.calculateMarks(av, + startx, endx)) { - int value = i; - if (av.hasHiddenColumns()) + int mpos = ((Integer) mark[1]).intValue(); // (i - startx - 1) + if (mpos < 0) { - value = av.getColumnSelection().adjustForHiddenColumns(value); + continue; } + String mstring = (String) mark[2]; - g.drawString(String.valueOf(value), (i - startx - 1) * charWidth, - ypos - (charHeight / 2)); - - g.drawLine(((i - startx - 1) * charWidth) + (charWidth / 2), - (ypos + 2) - (charHeight / 2), ((i - startx - 1) * charWidth) - + (charWidth / 2), ypos - 2); + if (Boolean.valueOf((Boolean) mark[0])) + { + if (mstring != null) + { + g.drawString(mstring, mpos * charWidth, ypos - (charHeight / 2)); + } + g.drawLine((mpos * charWidth) + (charWidth / 2), (ypos + 2) + - (charHeight / 2), (mpos * charWidth) + (charWidth / 2), + ypos - 2); + } } }