Skip to content

Commit 019ca4e

Browse files
committed
🚧 adjust focus proportion calculation
1 parent 512b530 commit 019ca4e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/components/tree/phyloTree/helpers.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ export const setDisplayOrder = ({nodes, focus}) => {
100100

101101
if (focus) {
102102
const numVisible = nodes[0].n.tipCount;
103-
const yProportionFocused = Math.max(0.8, numVisible / nodes.length);
103+
104+
let yProportionFocused = 0.8;
105+
// Adjust for a small number of visible tips (n<4)
106+
yProportionFocused = Math.min(yProportionFocused, numVisible / 5);
107+
// Adjust for a large number of visible tips (>80% of all tips)
108+
yProportionFocused = Math.max(yProportionFocused, numVisible / nodes.length);
109+
104110
const yPerFocused = (yProportionFocused * nodes.length) / numVisible;
105111
const yPerUnfocused = ((1 - yProportionFocused) * nodes.length) / (nodes.length - numVisible);
106112
incrementer = (() => {

0 commit comments

Comments
 (0)