Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix incorrect positioning for animation draggers on updateScale

Edward Platob51ef5324c52
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index 4fe526be0..15491a022 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -191,9 +191,9 @@ class TimelineAxis extends React.Component {
let animationStartDraggerLocation;
let animationEndDraggerLocation;
- if (true || this.props.startLocationDate) {
- animationStartDraggerLocation = Math.abs(frontDate.diff(this.props.animStartLocationDate, timeScale, true) * gridWidth);
- animationEndDraggerLocation = Math.abs(frontDate.diff(this.props.animEndLocationDate, timeScale, true) * gridWidth);
+ if (this.props.animStartLocationDate) {
+ animationStartDraggerLocation = moment.utc(this.props.animStartLocationDate).diff(frontDate, timeScale, true) * gridWidth;
+ animationEndDraggerLocation = moment.utc(this.props.animEndLocationDate).diff(frontDate, timeScale, true) * gridWidth;
}
// get axis bounds
diff --git a/web/js/components/timeline/timeline.js b/web/js/components/timeline/timeline.js
index bfdfd3fd3..25663f3c9 100644
--- a/web/js/components/timeline/timeline.js
+++ b/web/js/components/timeline/timeline.js
@@ -101,7 +101,6 @@ class Timeline extends React.Component {
} else {
previousPastDateBasedOnIncrement = moment.utc(this.state.dateFormattedB).subtract(this.state.intervalChangeAmt, this.state.timeScaleChangeUnit);
}
- console.log(previousPastDateBasedOnIncrement.isSameOrBefore(this.state.timelineStartDateLimit))
this.setState({
leftArrowDisabled: previousPastDateBasedOnIncrement.isSameOrBefore(this.state.timelineStartDateLimit)
})
@@ -115,7 +114,6 @@ class Timeline extends React.Component {
} else {
nextFutureDateBasedOnIncrement = moment.utc(this.state.dateFormattedB).add(this.state.intervalChangeAmt, this.state.timeScaleChangeUnit);
}
- console.log(nextFutureDateBasedOnIncrement.isSameOrAfter(this.state.timelineEndDateLimit))
this.setState({
rightArrowDisabled: nextFutureDateBasedOnIncrement.isSameOrAfter(this.state.timelineEndDateLimit)
})
@@ -172,11 +170,8 @@ class Timeline extends React.Component {
// }
componentDidUpdate(prevProps, prevState) {
- if (this.state.intervalChangeAmt !== prevState.intervalChangeAmt || this.state.timeScaleChangeUnit !== prevState.timeScaleChangeUnit) {
- this.checkLeftArrowDisabled();
- this.checkRightArrowDisabled();
- }
- if ((this.state.draggerSelected === 'selected' && this.state.dateFormatted !== prevState.dateFormatted)
+ if ((this.state.intervalChangeAmt !== prevState.intervalChangeAmt || this.state.timeScaleChangeUnit !== prevState.timeScaleChangeUnit)
+ || (this.state.draggerSelected === 'selected' && this.state.dateFormatted !== prevState.dateFormatted)
|| (this.state.draggerSelected === 'selectedB' && this.state.dateFormattedB !== prevState.dateFormattedB)) {
this.checkLeftArrowDisabled();
this.checkRightArrowDisabled();