-// PhylogenyNode furthestNode = PhylogenyMethods.calculateNodeWithMaxDistanceToRoot( _phylogeny );
-// _furthest_node_x = furthestNode.getXcoord();
-// _root_x = _phylogeny.getRoot().getXcoord();
-//
-// if (_furthest_node_x != _root_x && !(clicked_x < _root_x || clicked_x > _furthest_node_x)) // don't
-// // of tree
-// {
-// float threshold = (clicked_x - _root_x) / (_furthest_node_x - _root_x);
-// //draw vertical line at clicked_x
-// }
-//
-// _partition_tree = false;}
- }}
+
+ _clicked_x = e.getX();
+ if (!getPhylogeny().isEmpty()) {
+ // should be calculated on each partition as the tree can theoretically
+ // change in the meantime
+ PhylogenyNode furthestNode = PhylogenyMethods.calculateNodeWithMaxDistanceToRoot( _phylogeny );
+ _furthest_node_x = furthestNode.getXcoord();
+ _root_x = _phylogeny.getRoot().getXcoord();
+
+ // don't bother if 0 distance tree or clicked x lies outside of tree
+ if (_furthest_node_x != _root_x && !(_clicked_x < _root_x || _clicked_x > _furthest_node_x))
+ {
+ _partition_tree = true;
+
+ }
+
+
+ }
+ }
+ }