Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix animation stopping on axis position update for partially offscreen animation ranges

Edward Plato555a53ead766
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index d0807126b..0bc1049d5 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -505,7 +505,7 @@ class TimelineAxis extends Component {
if (draggerTimeState !== dateA || prevProps.dateA !== dateA) {
if (prevProps.dateA === draggerTimeState) {
// handle tour url date change
- if (isTourActive) {
+ if (isTourActive && !this.props.isAnimationPlaying) {
this.updateScale(dateA, timeScale, null, 0.5);
} else {
// handle animation dragger update
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index a70731aa0..745c44423 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -317,8 +317,6 @@ function mapStateToProps(state) {
let { customSelected, interval, delta, customInterval, customDelta, appNow } = date;
const hasCustomPalettes = !lodashIsEmpty(palettes[activeStr]);
- // let minDate = new Date(config.startDate);
- // let maxDate = layersLastDateTime(layers[activeStr], config);
let minDate = new Date(config.startDate);
let maxDate = appNow;
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 53773736d..e051a57e1 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -627,7 +627,7 @@ class Timeline extends React.Component {
if (prevStartLocationDate && prevEndLocationDate) {
if (prevStartLocationDate.getTime() !== animStartLocationDate.getTime() ||
prevEndLocationDate.getTime() !== animEndLocationDate.getTime() ||
- prevState.frontDate !== this.state.frontDate) {
+ (prevState.frontDate !== this.state.frontDate && !this.props.isAnimationPlaying)) {
this.animationDraggerDateUpdate(animStartLocationDate, animEndLocationDate);
}
}
@@ -757,6 +757,7 @@ class Timeline extends React.Component {
customSelected,
customIntervalValue,
customIntervalZoomLevel,
+ isAnimationPlaying,
isCompareModeActive,
axisWidth,
timelineEndDateLimit,
@@ -861,6 +862,7 @@ class Timeline extends React.Component {
>
{/* Axis */}
<TimelineAxis
+ isAnimationPlaying={isAnimationPlaying}
isTourActive={isTourActive}
frontDate={frontDate}
backDate={backDate}
@@ -1131,7 +1133,8 @@ function mapStateToProps(state) {
(modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT') || animation.gifActive,
animationDisabled:
!lodashGet(map, 'ui.selected.frameState_') ||
- sidebar.activeTab === 'download'
+ sidebar.activeTab === 'download',
+ isAnimationPlaying: animation.isPlaying
};
}
@@ -1224,7 +1227,8 @@ Timeline.propTypes = {
onUpdateStartDate: PropTypes.func,
onUpdateEndDate: PropTypes.func,
onUpdateStartAndEndDate: PropTypes.func,
- isTourActive: PropTypes.bool
+ isTourActive: PropTypes.bool,
+ isAnimationPlaying: PropTypes.bool
};
// get axisWidth and parentOffset for axis, footer, and leftOffset calculations
diff --git a/web/js/modules/animation/actions.js b/web/js/modules/animation/actions.js
index 01f3ab49c..6dc3e7d3a 100644
--- a/web/js/modules/animation/actions.js
+++ b/web/js/modules/animation/actions.js
@@ -11,16 +11,11 @@ import {
TOGGLE_GIF
} from './constants';
-import {
- timeScaleFromNumberKey
-} from '../date/constants';
-
export function onActivate() {
return (dispatch, getState) => {
const { compare, date } = getState();
const dateStr = compare.isCompareA ? 'selected' : 'selectedB';
- const interval = timeScaleFromNumberKey[date.interval];
- dispatch({ type: OPEN_ANIMATION, date: date[dateStr], interval: interval });
+ dispatch({ type: OPEN_ANIMATION, date: date[dateStr] });
};
}
export function onClose() {
diff --git a/web/js/modules/animation/reducers.js b/web/js/modules/animation/reducers.js
index cf49deca8..38b34591f 100644
--- a/web/js/modules/animation/reducers.js
+++ b/web/js/modules/animation/reducers.js
@@ -20,8 +20,7 @@ const defaultState = {
speed: 3,
gifActive: false,
startDate: undefined,
- endDate: undefined,
- beenActivated: false
+ endDate: undefined
};
export function getInitialState(config) {
return lodashAssign({}, defaultState, {
@@ -36,11 +35,12 @@ export function animationReducer(state = defaultState, action) {
return lodashAssign({}, state, {
isActive: true,
gifActive: false,
- startDate: !state.beenActivated ? util.dateAdd(action.date, action.interval, -7)
- : state.startDate,
- endDate: !state.beenActivated ? action.date
- : state.endDate,
- beenActivated: true
+ startDate: state.startDate
+ ? state.startDate
+ : util.dateAdd(action.date, action.interval, -7),
+ endDate: state.endDate
+ ? state.endDate
+ : action.date
});
case EXIT_ANIMATION:
return lodashAssign({}, state, {