From: amwaterhouse Date: Thu, 7 Apr 2005 16:56:53 +0000 (+0000) Subject: draws threshold position according to threshold, not mouse x X-Git-Tag: Release_2_0~468 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7fec702aa740923869b87bafeec45e6f56e8b830;p=jalview.git draws threshold position according to threshold, not mouse x --- diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 9435716..b5200d5 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -27,7 +27,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print int offx = 20; int offy = 20; - int threshold; + float threshold; String longestName; int labelLength=-1; @@ -343,7 +343,10 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print if (threshold != 0) { g.setColor(Color.red); - g.drawLine(threshold,0,threshold,getHeight()); + + int x = (int)( threshold * (float)(getWidth()-labelLength - 2*offx) +offx ) ; + + g.drawLine(x,0,x,getHeight()); } scrollPane.revalidate(); @@ -401,10 +404,10 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print // Find threshold if (tree.getMaxHeight() != 0) { - float fthreshold = (float)(x - offx)/(float)(getWidth()-labelLength - 2*offx); - this.threshold = x; + threshold = (float)(x - offx)/(float)(getWidth()-labelLength - 2*offx); + tree.getGroups().removeAllElements(); - tree.groupNodes(tree.getTopNode(),fthreshold); + tree.groupNodes(tree.getTopNode(),threshold); setColor(tree.getTopNode(),Color.black); av.setSelectionGroup(null);