draws threshold position according to threshold, not mouse x
authoramwaterhouse <Andrew Waterhouse>
Thu, 7 Apr 2005 16:56:53 +0000 (16:56 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 7 Apr 2005 16:56:53 +0000 (16:56 +0000)
src/jalview/gui/TreeCanvas.java

index 9435716..b5200d5 100755 (executable)
@@ -27,7 +27,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print
   int offx = 20;\r
   int offy = 20;\r
 \r
-  int threshold;\r
+  float threshold;\r
 \r
   String longestName;\r
   int labelLength=-1;\r
@@ -343,7 +343,10 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print
     if (threshold != 0)\r
     {\r
         g.setColor(Color.red);\r
-        g.drawLine(threshold,0,threshold,getHeight());\r
+\r
+        int x = (int)(    threshold * (float)(getWidth()-labelLength - 2*offx) +offx   ) ;\r
+\r
+        g.drawLine(x,0,x,getHeight());\r
     }\r
 \r
     scrollPane.revalidate();\r
@@ -401,10 +404,10 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print
           // Find threshold\r
 \r
           if (tree.getMaxHeight() != 0) {\r
-              float fthreshold = (float)(x - offx)/(float)(getWidth()-labelLength - 2*offx);\r
-              this.threshold = x;\r
+              threshold = (float)(x - offx)/(float)(getWidth()-labelLength - 2*offx);\r
+\r
               tree.getGroups().removeAllElements();\r
-              tree.groupNodes(tree.getTopNode(),fthreshold);\r
+              tree.groupNodes(tree.getTopNode(),threshold);\r
               setColor(tree.getTopNode(),Color.black);\r
 \r
               av.setSelectionGroup(null);\r