Skip to content

rerootAbove

function rerootAbove(
tree,
selection,
nodeId
):
| Pick<TreeSelection, "rerootedAt" | "rerootPosition">
| null;

Defined in: packages/components/src/components/PhyloTree/utils/treeOps.ts:130

The rerootedAt/rerootPosition that put the root halfway along the branch as displayed above nodeId. Use this (rather than { rerootedAt: nodeId }) for a “reroot here” action on a tree that may already be rerooted: rerootedAt names a branch of the tree as passed in, and after a reroot the branch drawn above a node can be a different one — or two merged through the old root. Returns null for the root.

Parameter Type
tree Tree
selection Partial<TreeSelection>
nodeId string

| Pick<TreeSelection, "rerootedAt" | "rerootPosition"> | null