From 83da57e0af4c310c22df7e20445383c183a6e335 Mon Sep 17 00:00:00 2001 From: James Hadfield Date: Thu, 28 Apr 2022 14:04:38 +1200 Subject: [PATCH] Show labels for subtree root nodes 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). --- src/components/tree/phyloTree/labels.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/tree/phyloTree/labels.js b/src/components/tree/phyloTree/labels.js index 85e245b1e..23773ceb7 100644 --- a/src/components/tree/phyloTree/labels.js +++ b/src/components/tree/phyloTree/labels.js @@ -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"; };