Skip to content

Commit

Permalink
[explode] don't allow tanglegrams
Browse files Browse the repository at this point in the history
Tanglegrams would be useful for exploded trees but are added complexity for an already complex feature. For the time being, it's acceptable to force users to choose one or the other.
  • Loading branch information
jameshadfield committed Jan 30, 2022
1 parent cc1c5c2 commit efcf523
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/actions/loadData.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { parseMarkdownNarrativeFile } from "../util/parseNarrative";
import { NoContentError } from "../util/exceptions";
import { parseMarkdown } from "../util/parseMarkdown";
import { updateColorByWithRootSequenceData } from "../actions/colors";
import { explodeTree } from "./tree";

export function getDatasetNamesFromUrl(url) {
let secondTreeUrl;
Expand Down Expand Up @@ -41,6 +42,12 @@ export const loadSecondTree = (secondTreeUrl, firstTreeUrl) => async (dispatch,
}

const oldState = getState();

/* if the first tree is exploded, then reconstruct it before loading a second tree */
if (oldState.controls.explodeAttr) {
dispatch(explodeTree(undefined));
}

const newState = createTreeTooState({treeTooJSON: secondJson.tree, oldState, originalTreeUrl: firstTreeUrl, secondTreeUrl: secondTreeUrl, dispatch});
dispatch({type: types.TREE_TOO_DATA, ...newState});
};
Expand Down
4 changes: 3 additions & 1 deletion src/components/controls/choose-explode-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { controlsWidth } from "../../util/globals";
*/
@connect((state) => ({
selected: state.controls.explodeAttr,
available: state.metadata.colorings
available: state.metadata.colorings,
showThisUI: !state.controls.showTreeToo
}))
class ChooseExplodeAttr extends React.Component {
constructor(props) {
Expand All @@ -31,6 +32,7 @@ class ChooseExplodeAttr extends React.Component {
return options;
}
render() {
if (!this.props.showThisUI) return null;
const { t } = this.props;
return (
<div style={{paddingTop: 5}}>
Expand Down

0 comments on commit efcf523

Please sign in to comment.