X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FTreeCanvas.java;h=eb4253fc901b3c328081990d7058a7cb7928fc39;hb=7f5ab7d1f58d870622968e0e6a430f33403b8e4f;hp=54eed1a73c9dcf6b049a5e872c85f97ad072061a;hpb=d6a30c6516e8e2f923c8c2f6dce7592cb3b7d974;p=jalview.git diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 54eed1a..eb4253f 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -207,7 +207,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, * DOCUMENT ME! * @param chunk * DOCUMENT ME! - * @param scale + * @param wscale * DOCUMENT ME! * @param width * DOCUMENT ME! @@ -217,7 +217,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, * DOCUMENT ME! */ public void drawNode(Graphics g, SequenceNode node, float chunk, - float scale, int width, int offx, int offy) + double wscale, int width, int offx, int offy) { if (node == null) { @@ -227,11 +227,11 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if ((node.left() == null) && (node.right() == null)) { // Drawing leaf node - float height = node.height; - float dist = node.dist; + double height = node.height; + double dist = node.dist; - int xstart = (int) ((height - dist) * scale) + offx; - int xend = (int) (height * scale) + offx; + int xstart = (int) ((height - dist) * wscale) + offx; + int xend = (int) (height * wscale) + offx; int ypos = (int) (node.ycount * chunk) + offy; @@ -306,16 +306,16 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, } else { - drawNode(g, (SequenceNode) node.left(), chunk, scale, width, offx, + drawNode(g, (SequenceNode) node.left(), chunk, wscale, width, offx, offy); - drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx, + drawNode(g, (SequenceNode) node.right(), chunk, wscale, width, offx, offy); - float height = node.height; - float dist = node.dist; + double height = node.height; + double dist = node.dist; - int xstart = (int) ((height - dist) * scale) + offx; - int xend = (int) (height * scale) + offx; + int xstart = (int) ((height - dist) * wscale) + offx; + int xend = (int) (height * wscale) + offx; int ypos = (int) (node.ycount * chunk) + offy; g.setColor(node.color.darker()); @@ -339,8 +339,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5); nodeHash.put(node, pos); - g.drawLine((int) (height * scale) + offx, ystart, - (int) (height * scale) + offx, yend); + g.drawLine((int) (height * wscale) + offx, ystart, + (int) (height * wscale) + offx, yend); String nodeLabel = ""; @@ -422,7 +422,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, SequenceNode top = tree.getTopNode(); - float wscale = (float) ((width * .8) - (offx * 2)) + double wscale = ((width * .8) - (offx * 2)) / tree.getMaxHeight(); if (top.count == 0) @@ -445,7 +445,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, * DOCUMENT ME! * @param chunk * DOCUMENT ME! - * @param scale + * @param wscale * DOCUMENT ME! * @param width * DOCUMENT ME! @@ -455,7 +455,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, * DOCUMENT ME! */ public void pickNode(Rectangle pickBox, SequenceNode node, float chunk, - float scale, int width, int offx, int offy) + double wscale, int width, int offx, int offy) { if (node == null) { @@ -464,11 +464,11 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if ((node.left() == null) && (node.right() == null)) { - float height = node.height; - float dist = node.dist; + double height = node.height; + double dist = node.dist; - int xstart = (int) ((height - dist) * scale) + offx; - int xend = (int) (height * scale) + offx; + int xstart = (int) ((height - dist) * wscale) + offx; + int xend = (int) (height * wscale) + offx; int ypos = (int) (node.ycount * chunk) + offy; @@ -488,9 +488,9 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, } else { - pickNode(pickBox, (SequenceNode) node.left(), chunk, scale, width, + pickNode(pickBox, (SequenceNode) node.left(), chunk, wscale, width, offx, offy); - pickNode(pickBox, (SequenceNode) node.right(), chunk, scale, width, + pickNode(pickBox, (SequenceNode) node.right(), chunk, wscale, width, offx, offy); } } @@ -715,7 +715,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, labelLength = fm.stringWidth(longestName) + 20; // 20 allows for scrollbar - float wscale = (width - labelLength - (offx * 2)) / tree.getMaxHeight(); + double wscale = (width - labelLength - (offx * 2)) + / tree.getMaxHeight(); SequenceNode top = tree.getTopNode();