From 019ca4e033e6d6c0f42ab97ad9229d87acf90be7 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:57:48 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20adjust=20focus=20proportion=20ca?= =?UTF-8?q?lculation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/tree/phyloTree/helpers.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/tree/phyloTree/helpers.js b/src/components/tree/phyloTree/helpers.js index 0a038fa19..f604190e8 100644 --- a/src/components/tree/phyloTree/helpers.js +++ b/src/components/tree/phyloTree/helpers.js @@ -100,7 +100,13 @@ export const setDisplayOrder = ({nodes, focus}) => { if (focus) { const numVisible = nodes[0].n.tipCount; - const yProportionFocused = Math.max(0.8, numVisible / nodes.length); + + let yProportionFocused = 0.8; + // Adjust for a small number of visible tips (n<4) + yProportionFocused = Math.min(yProportionFocused, numVisible / 5); + // Adjust for a large number of visible tips (>80% of all tips) + yProportionFocused = Math.max(yProportionFocused, numVisible / nodes.length); + const yPerFocused = (yProportionFocused * nodes.length) / numVisible; const yPerUnfocused = ((1 - yProportionFocused) * nodes.length) / (nodes.length - numVisible); incrementer = (() => {