Resize timeline on entering narrative mode

This commit is contained in:
Franc Camps-Febrer
2019-01-09 08:19:16 +01:00
committed by Lachlan Kermode
parent 7beb5f4039
commit 34c18a6102

View File

@@ -68,6 +68,11 @@ class Timeline extends React.Component {
addEventListeners() {
window.addEventListener('resize', () => { this.computeDims(); });
let element = document.querySelector('.timeline-wrapper');
element.addEventListener("transitionend", (event) => {
this.computeDims();
}, false);
}
makeScaleX() {
@@ -109,7 +114,8 @@ class Timeline extends React.Component {
const boundingClient = document.querySelector(`#${dom}`).getBoundingClientRect();
this.setState({
dims: Object.assign({}, this.state.dims, { width: boundingClient.width })
dims: Object.assign({}, this.state.dims, { width: boundingClient.width })
}, () => { this.setState({ scaleX: this.makeScaleX() })
});
}
}