Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fix anim onload bug #1903

Benjamin Kingd94e683c26f8
diff --git a/web/js/app.js b/web/js/app.js
index ca3accd84..888e3efba 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -93,8 +93,7 @@ class App extends React.Component {
document.removeEventListener('keypress', this.handleKeyPress);
}
render() {
- const { isAnimationWidgetActive, isTourActive } = this.props;
-
+ const { isAnimationWidgetActive, isTourActive, locationKey } = this.props;
return (
<div className="wv-content" id="wv-content" data-role="content">
<Toolbar />
@@ -106,7 +105,7 @@ class App extends React.Component {
<div id="eventsHolder" />
<div id="imagedownload" />
<div id="dlMap" />
- <Timeline />
+ <Timeline key={locationKey || '1'} />
<div id="wv-animation-widet-case">
{isAnimationWidgetActive ? <AnimationWidget /> : null}
</div>
@@ -166,10 +165,12 @@ function mapStateToProps(state, ownProps) {
state: state,
isAnimationWidgetActive: state.animation.isActive,
isTourActive: state.tour.active,
+ tour: state.tour,
config: state.config,
parameters: state.parameters,
models: ownProps.models,
- mapMouseEvents: ownProps.mapMouseEvents
+ mapMouseEvents: ownProps.mapMouseEvents,
+ locationKey: state.location.key
};
}
const mapDispatchToProps = dispatch => ({
@@ -189,6 +190,7 @@ App.propTypes = {
isAnimationWidgetActive: PropTypes.bool,
isTourActive: PropTypes.bool,
keyPressAction: PropTypes.func,
+ locationKey: PropTypes.string,
mapMouseEvents: PropTypes.object,
parameters: PropTypes.object,
state: PropTypes.object
diff --git a/web/js/modules/animation/util.js b/web/js/modules/animation/util.js
index 7abea6631..c9e578620 100644
--- a/web/js/modules/animation/util.js
+++ b/web/js/modules/animation/util.js
@@ -123,7 +123,10 @@ export function mapLocationToAnimationState(
stateFromLocation = update(stateFromLocation, {
animation: { isPlaying: { $set: true } }
});
- } else if (!parameters.ae || (!parameters.as && (!!endDate || !!startDate))) {
+ } else if (
+ parameters.ab !== 'on' &&
+ (!parameters.ae || (!parameters.as && (!!endDate || !!startDate)))
+ ) {
// wipe anim start & end dates on tour change
stateFromLocation = update(stateFromLocation, {
diff --git a/web/js/modules/combine-reducers.js b/web/js/modules/combine-reducers.js
index 804f25aed..8ff963541 100644
--- a/web/js/modules/combine-reducers.js
+++ b/web/js/modules/combine-reducers.js
@@ -35,8 +35,9 @@ import {
getInitialVectorStyleState
} from './vector-styles/reducers';
import dataDownloadReducer from './data/reducers';
-import { get as lodashGet } from 'lodash';
+import { get as lodashGet, assign as lodashAssign } from 'lodash';
import { imageDownloadReducer } from './image-download/reducers';
+import { LOCATION_POP_ACTION } from '../redux-location-state-customs';
function lastAction(state = null, action) {
return action;
@@ -88,6 +89,13 @@ export function getInitialState(models, config, parameters) {
vectorStyles: getInitialVectorStyleState(config)
};
}
+const locationReducer = (state = { key: '' }, action) => {
+ if (action.type === LOCATION_POP_ACTION) {
+ return lodashAssign({}, state, { key: action.payload.key });
+ } else {
+ return state;
+ }
+};
const defaultReducer = (state = {}) => state;
const reducers = {
proj: projectionReducer,
@@ -116,7 +124,8 @@ const reducers = {
modalAboutPage,
shortLink,
notificationsRequest,
- lastAction: lastAction
+ lastAction: lastAction,
+ location: locationReducer
};
const appReducer = combineReducers(reducers);
/**