Skip to content

Commit

Permalink
Merge pull request #644 from nextstrain/643
Browse files Browse the repository at this point in the history
Force default tree zoom to root
  • Loading branch information
jameshadfield committed Aug 27, 2018
2 parents 2f5fb36 + b6af18f commit 0ee9bce
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 0ee9bce

Please sign in to comment.