Skip to content

Commit

Permalink
🚧 re-focus on date range changes
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Oct 14, 2024
1 parent dd35e7d commit ba86c18
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/tree/reactD3Interface/change.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export const changePhyloTreeViaPropsComparison = (mainTree, phylotree, oldProps,

/* zoom to a clade / reset zoom to entire tree */
const zoomChange = oldTreeRedux.idxOfInViewRootNode !== newTreeRedux.idxOfInViewRootNode;


const dateRangeChange = oldProps.dateMinNumeric !== newProps.dateMinNumeric ||
oldProps.dateMaxNumeric !== newProps.dateMaxNumeric;

const filterChange = oldTreeRedux.filters !== newTreeRedux.filters;

/* do any properties on the tree object need to be updated?
Expand Down Expand Up @@ -60,7 +63,7 @@ export const changePhyloTreeViaPropsComparison = (mainTree, phylotree, oldProps,
args.updateLayout = true;
}
/* re-focus on changes */
else if (oldProps.focus && (zoomChange || filterChange)) {
else if (oldProps.focus && (zoomChange || dateRangeChange || filterChange)) {
args.newFocus = true;
args.updateLayout = true;
}
Expand Down

0 comments on commit ba86c18

Please sign in to comment.