-
Notifications
You must be signed in to change notification settings - Fork 168
Reset layout when nucleotide position is selected #1947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,7 +128,6 @@ | |
|
|
||
| resetLayout(styles) { | ||
| if (this.props.narrativeMode || !this.state.chart) return null; | ||
| const viewingGenome = this.props.selectedCds===nucleotide_gene; | ||
| /** | ||
| * The intention for this button is to be inactive when viewing the genome & | ||
| * fully zoomed out, however zoom actions do not trigger redux state changes | ||
|
|
@@ -142,14 +141,13 @@ | |
| key={1} | ||
| style={tabGroupMember} | ||
| onClick={() => { | ||
| if (viewingGenome) { | ||
| this.state.chart.update({ | ||
| zoomMin: this.state.chart.zoomBounds[0], | ||
| zoomMax: this.state.chart.zoomBounds[1], | ||
| }) | ||
| } else { | ||
| this.props.dispatch(changeEntropyCdsSelection(nucleotide_gene)); | ||
| } | ||
| // if (this.props.selectedCds === nucleotide_gene) { | ||
| // this.state.chart.update({ | ||
| // zoomMin: this.state.chart.zoomBounds[0], | ||
| // zoomMax: this.state.chart.zoomBounds[1], | ||
| // }) | ||
| // } | ||
| this.props.dispatch(changeEntropyCdsSelection(nucleotide_gene)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this change (and the earlier change), the following just above this line becomes unnecessary and can be removed: if (viewingGenome) {
this.state.chart.update({
zoomMin: this.state.chart.zoomBounds[0],
zoomMax: this.state.chart.zoomBounds[1],
})
}This is because we end up running if (selectedCds || selectedPositions !== undefined) {
this._setZoomCoordinates(zoomMin, zoomMax, !!selectedCds);
}so we'll always reset the coordinates to show the entire nuc span.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's still used for when no CDS or position is selected, when the min/max sliders are adjusted. I think the update can happen elsewhere though. Started with 1f40cd0 but haven't gotten it fully working. |
||
| }} | ||
| > | ||
| <span style={styles.switchTitle}> {'RESET LAYOUT'} </span> | ||
|
|
@@ -221,6 +219,8 @@ | |
| } | ||
| } | ||
| UNSAFE_componentWillReceiveProps(nextProps) { | ||
| console.log(`[UNSAFE_componentWillReceiveProps] nextProps:`) | ||
| console.log(nextProps) | ||
| if (!nextProps.loaded) { | ||
| this.setState({chart: false}); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you've highlighted a nucleotide bar (in the entropy panel) and click "reset layout" the bar will no longer be highlighted because now
action.selectedPositions = [];will be hit below.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply dropping
action.selectedPositions = []doesn't work, I think because zoom bounds are tightly coupled with selected positions here:auspice/src/components/entropy/entropyD3.js
Lines 131 to 145 in 1f40cd0