Skip to content

Commit

Permalink
force default tree zoom to root
Browse files Browse the repository at this point in the history
  • Loading branch information
emmahodcroft committed Aug 27, 2018
1 parent 2f5fb36 commit b6af18f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/actions/recomputeReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ const modifyTreeStateVisAndBranchThickness = (oldState, tipSelected, cladeSelect
oldState.selectedStrain = tipSelected;
}
if (cladeSelected) {
const cladeSelectedIdx = cladeNameToIdx(oldState.nodes, cladeSelected);
const cladeSelectedIdx = cladeSelected === 'root' ? 0 : cladeNameToIdx(oldState.nodes, cladeSelected);
oldState.selectedClade = cladeSelected;
newIdxRoot = applyInViewNodesToTree(cladeSelectedIdx, oldState); // tipSelectedIdx, oldState);
}
Expand Down Expand Up @@ -525,6 +525,8 @@ export const createStateFromQueryOrJSONs = ({

if (query.clade) {
tree = modifyTreeStateVisAndBranchThickness(tree, undefined, query.clade, controls);
} else { /* if not specifically given in URL, zoom to root */
tree = modifyTreeStateVisAndBranchThickness(tree, undefined, 'root', controls);
}
tree = modifyTreeStateVisAndBranchThickness(tree, query.s, undefined, controls);
if (treeToo && treeToo.loaded) {
Expand Down

0 comments on commit b6af18f

Please sign in to comment.