Skip to content

Commit

Permalink
Move callbacks out of constructor
Browse files Browse the repository at this point in the history
Keep consistent with other parts of the file.
  • Loading branch information
victorlin committed Oct 8, 2024
1 parent 27e5aa8 commit 1eedee4
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/components/tree/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,23 @@ class Tree extends React.Component {
tree: null,
treeToo: null
};
/* bind callbacks */
this.clearSelectedNode = callbacks.clearSelectedNode.bind(this);
this.redrawTree = () => {
this.props.dispatch(updateVisibleTipsAndBranchThicknesses({
root: [0, 0]
}));
};
/* pressing the escape key should dismiss an info modal (if one exists) */
this.handlekeydownEvent = (event) => {
if (event.key==="Escape" && this.props.selectedNode) {
this.clearSelectedNode(this.props.selectedNode);
}
};
}

clearSelectedNode = () => {
callbacks.clearSelectedNode.bind(this);
}

redrawTree = () => {
this.props.dispatch(updateVisibleTipsAndBranchThicknesses({
root: [0, 0]
}));
}

/* pressing the escape key should dismiss an info modal (if one exists) */
handlekeydownEvent = (event) => {
if (event.key==="Escape" && this.props.selectedNode) {
this.clearSelectedNode(this.props.selectedNode);
}
}

setUpAndRenderTreeToo(props, newState) {
Expand Down

0 comments on commit 1eedee4

Please sign in to comment.