react-phylogeny-tree-gl
Version:
React integration of phylocanvas.gl. Component and hook for phylogenetic tree visualistion.
16 lines • 655 B
JavaScript
export function createOnViewSubtreePlugin(onViewSubtree) {
return function onViewSubtreePlugin(tree, decorate) {
decorate('setRoot', (delegate, args) => {
const [nodeOrId] = args;
const node = this.findNodeById(nodeOrId);
if (node === null || node === undefined || !node.isLeaf) {
delegate(...args);
if (tree) {
const leafs = tree.getGraphAfterLayout().leaves.map((value) => value.label || value.id);
onViewSubtree(tree, leafs);
}
}
});
};
}
//# sourceMappingURL=createPluginOnViewSubtree.js.map