UNPKG

react-phylogeny-tree-gl

Version:

React integration of phylocanvas.gl. Component and hook for phylogenetic tree visualistion.

14 lines 634 B
import { useEffect } from 'react'; import { setRootNLevelsUp } from '../utils'; export function useLeafSubtree(getTree, { leafSubtree: { leafID, noLevels, minLeafToRootLength, setLeafLabels } }) { useEffect(() => { const tree = getTree(); if (tree && leafID) { setRootNLevelsUp(tree, leafID, noLevels, minLeafToRootLength); const ids = tree.getGraphAfterLayout().leaves.map((value) => value.id); if (setLeafLabels) setLeafLabels(ids); } }, [leafID, noLevels, minLeafToRootLength, setLeafLabels, getTree]); } //# sourceMappingURL=useLeafSubtree.js.map