From 7fec702aa740923869b87bafeec45e6f56e8b830 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 7 Apr 2005 16:56:53 +0000 Subject: [PATCH] draws threshold position according to threshold, not mouse x --- src/jalview/gui/TreeCanvas.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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); -- 1.7.10.2