Skip to content

Commit

Permalink
Show labels for subtree root nodes
Browse files Browse the repository at this point in the history
This commit is related to the recent PR #1501 which hid (non-aa) labels
depending on their in-view tip-fraction. Here if the label is on the
root of a subtree then we always show it (unless the label is "aa" as
these can be very long).
  • Loading branch information
jameshadfield committed Apr 28, 2022
1 parent 27a88ad commit 83da57e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/tree/phyloTree/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ const createBranchLabelVisibility = (key, layout, totalTipsInView) => (d) => {
if (d.n.tipCount > magicTipFractionToShowBranchLabel * totalTipsInView) {
return "visible";
}
/* if the label is on the root of a subtree then always show it
(unless the label is "aa" as these can be very long) */
if (key!=='aa' && (d.n.name===d.n.parent.name || d.n.parent.name==="__ROOT")) {
return "visible";
}
return "hidden";
};

Expand Down

0 comments on commit 83da57e

Please sign in to comment.