Skip to content

Commit

Permalink
🚧 adjust focus proportion calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Oct 17, 2024
1 parent 512b530 commit 019ca4e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/tree/phyloTree/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (() => {
Expand Down

0 comments on commit 019ca4e

Please sign in to comment.