Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix merge conflicts

Edward Platoe86d6f12486d
diff --cc web/js/containers/timeline/timeline.js
index 534179994,c6d8424bb..8f46b26bc
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@@ -10,10 -10,12 +10,12 @@@ import CustomIntervalSelectorWidget fro
import util from '../../util/util';
import DateSelector from '../../components/date-selector/date-selector';
import DateChangeArrows from '../../components/timeline/timeline-controls/date-change-arrows';
-import AnimationWidget from '../../containers/animation-widget';
+import AnimationWidget from '../animation-widget';
import AnimationButton from '../../components/timeline/timeline-controls/animation-button';
-
import AxisTimeScaleChange from '../../components/timeline/timeline-controls/axis-timescale-change';
+
+ import lodashDebounce from 'lodash/debounce';
+
import {
hasSubDaily,
lastDate as layersLastDateTime
@@@ -99,13 -89,15 +89,15 @@@ class Timeline extends React.Component
changeDate(util.dateAdd(selectedDate, increment, delta));
}
}
- this.animator = setTimeout(animate, ANIMATION_DELAY);
- this.setState({
- animationInProcess: true
- });
+ if (this.state.animationInProcess) {
+ this.animator = setInterval(() => animate, ANIMATION_DELAY);
+ }
};
+ this.setState({
+ animationInProcess: true
+ });
animate();
- }
+ };
// show/hide custom interval modal
toggleCustomIntervalModal = () => {
@@@ -121,17 -113,11 +113,14 @@@
// handle SET of custom time scale panel
changeCustomInterval = (delta, timeScale) => {
- this.props.changeCustomInterval(
- delta,
- Number(timeScaleToNumberKey[timeScale])
- );
- };
+ this.props.changeCustomInterval(Number(delta), Number(timeScale));
+ }
// handle SELECT of LEFT/RIGHT interval selection
- setTimeScaleIntervalChangeUnit = (intervalSelected, customIntervalModalOpen) => {
+ setTimeScaleIntervalChangeUnit = (
+ intervalSelected,
+ customIntervalModalOpen
+ ) => {
let delta;
let customSelected = intervalSelected === 'custom';
if (customSelected) {
@@@ -142,21 -128,28 +131,28 @@@
delta = 1;
}
this.props.selectInterval(delta, intervalSelected, customSelected);
- if (customIntervalModalOpen) {
- this.setState({
- customIntervalModalOpen: customIntervalModalOpen
- });
- }
- };
+ this.setState({
+ customIntervalModalOpen: !!customIntervalModalOpen
+ });
+ }
- // left/right arrows increment date
- incrementDate = multiplier => {
+ // right arrow increment date
+ incrementDate = () => {
let delta = this.props.customSelected ? this.props.intervalChangeAmt : 1;
this.animateByIncrement(
- Number(delta * multiplier),
+ Number(delta),
+ this.props.timeScaleChangeUnit
+ );
+ }
+
+ // left arrow decrement date
+ decrementDate = () => {
+ let delta = this.props.customSelected ? this.props.intervalChangeAmt : 1;
+ this.animateByIncrement(
+ Number(delta * -1),
this.props.timeScaleChangeUnit
);
- }
+ };
// open animation dialog
clickAnimationButton = () => {
@@@ -325,15 -371,13 +374,14 @@@ function mapStateToProps(state)
hasSubdailyLayers = hasSubDaily(layers[compare.activeString]);
endTime = layersLastDateTime(layers[activeString], config);
}
- const dimensionsAndOffsetValues = getOffsetValues(screenWidth, hasSubdailyLayers);
+ const dimensionsAndOffsetValues = getOffsetValues(
+ screenWidth,
+ hasSubdailyLayers
+ );
const timelineEndDateLimit = endTime.toISOString();
- // console.log(date, compare);
let selectedDate = isCompareA ? selected : selectedB;
- let deltaChangeAmt = customSelected
- ? customDelta
- : delta;
+ let deltaChangeAmt = customSelected ? customDelta : delta;
let timeScaleChangeUnit = customSelected
? timeScaleFromNumberKey[customInterval]
: timeScaleFromNumberKey[interval];