Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add anim start end dates

Edward Platoce892c185d28
diff --git a/web/js/app.js b/web/js/app.js
index 730137834..6881f52ac 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -102,9 +102,9 @@ class App extends React.Component {
<div id="timewheels" style={{ display: 'none' }} />
<Timeline />
<OlCoordinates mouseEvents={this.props.mapMouseEvents} />
- <div id="wv-animation-widet-case">
+ {/* <div id="wv-animation-widet-case"> */}
{/* {config.features.animation ? <AnimationWidget /> : ''} */}
- </div>
+ {/* </div> */}
<Modal />
<ErrorBoundary>
<Debug parameters={this.props.parameters} />
diff --git a/web/js/components/range-selection/range-selection.js b/web/js/components/range-selection/range-selection.js
index 324ec966b..f65d345ae 100644
--- a/web/js/components/range-selection/range-selection.js
+++ b/web/js/components/range-selection/range-selection.js
@@ -137,6 +137,7 @@ class TimelineRangeSelector extends React.Component {
* @method render
*/
render() {
+ console.log(this.props)
return (
<svg
id="wv-timeline-range-selector"
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index 611be23d8..3b1b1312c 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -1354,10 +1354,10 @@ class TimelineAxis extends React.Component {
<TimelineRangeSelector
startLocation={this.state.animationStartLocation}
endLocation={this.state.animationEndLocation}
- startLocationDate={this.props.animStartLocationDate}
- endLocationDate={this.props.animEndLocationDate}
- timelineStartDateLimit={this.props.timelineStartDateLimit}
- timelineEndDateLimit={this.props.timelineEndDateLimit}
+ startLocationDate={moment.utc(this.props.animStartLocationDate).format()}
+ endLocationDate={moment.utc(this.props.animEndLocationDate).format()}
+ timelineStartDateLimit={moment.utc(this.props.timelineStartDateLimit).format()}
+ timelineEndDateLimit={moment.utc(this.props.timelineEndDateLimit).format()}
max={{end: false, start: false, startOffset: -50, width: 50000}}
pinWidth={5}
height={45}
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 967061a43..93371f023 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import moment from 'moment';
+import ErrorBoundary from '../../containers/error-boundary';
import TimeScaleIntervalChange from '../../components/timeline/timeline-controls/interval-timescale-change';
import '../../components/timeline/timeline.css';
import TimelineAxis from '../../components/timeline/timeline-axis/timeline-axis';
@@ -9,6 +10,7 @@ import CustomIntervalSelectorWidget from '../../components/timeline/interval-sel
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 AnimationButton from '../../components/timeline/timeline-controls/animation-button';
import AxisTimeScaleChange from '../../components/timeline/timeline-controls/axis-timescale-change';
@@ -18,7 +20,9 @@ import {
} from '../../modules/layers/selectors';
import { selectDate, changeTimeScale, selectInterval, changeCustomInterval } from '../../modules/date/actions';
// import { selectDraggerState } from '../../modules/compare/actions';
+import { onActivate as openAnimation, onClose as closeAnimation } from '../../modules/animation/actions';
import { timeScaleFromNumberKey, timeScaleToNumberKey } from '../../modules/date/constants';
+import errorBoundary from '../error-boundary';
const ANIMATION_DELAY = 500;
@@ -141,7 +145,12 @@ class Timeline extends React.Component {
}
// open animation dialog
- clickAnimationButton() {
+ clickAnimationButton = () => {
+ if (this.props.isAnimationWidgetOpen) {
+ this.props.closeAnimation();
+ } else {
+ this.props.openAnimation();
+ }
// Will be a setState({})
// a deriveStateFromProps will be wanted with this one
}
@@ -170,9 +179,13 @@ class Timeline extends React.Component {
timelineEndDateLimit,
timelineStartDateLimit,
timeScaleChangeUnit,
- parentOffset
+ parentOffset,
+ animStartLocationDate,
+ animEndLocationDate,
+ isAnimationWidgetOpen
} = this.props;
return dateFormatted ? (
+ <ErrorBoundary>
<section id="timeline" className="timeline-inner clearfix">
<div
id="timeline-header"
@@ -214,7 +227,12 @@ class Timeline extends React.Component {
<div id="timeline-footer"
style={{ display: this.state.timelineHidden ? 'none' : 'block' }}
>
- <div id="wv-animation-widet-case"> </div>
+ <div id="wv-animation-widet-case">
+ { isAnimationWidgetOpen
+ ? <AnimationWidget />
+ : null
+ }
+ </div>
{/* Timeline */}
<TimelineAxis
{...this.props}
@@ -233,11 +251,9 @@ class Timeline extends React.Component {
timelineEndDateLimit={timelineEndDateLimit}
updateAnimationRange={() => {
}}
- // animStartLocationDate={this.state.animStartLocationDate}
- // animEndLocationDate={this.state.animEndLocationDate}
- animStartLocationDate={dateFormatted}
- animEndLocationDate={dateFormatted}
- isAnimationWidgetOpen={this.state.isAnimationWidgetOpen}
+ animStartLocationDate={animStartLocationDate}
+ animEndLocationDate={animEndLocationDate}
+ isAnimationWidgetOpen={isAnimationWidgetOpen}
/>
{/* custom interval selector */}
@@ -275,6 +291,7 @@ class Timeline extends React.Component {
/>
</div>
</section>
+ </ErrorBoundary>
) : null;
}
}
@@ -327,7 +344,7 @@ function mapStateToProps(state) {
timeScaleChangeUnit,
timelineEndDateLimit
);
-
+console.log(animation.isActive, animation)
return {
draggerSelected: isCompareA ? 'selected' : 'selectedB', // ! will work for dragger?
hasSubdailyLayers,
@@ -338,7 +355,9 @@ function mapStateToProps(state) {
startDate: config.startDate,
timelineStartDateLimit: config.startDate, // same as startDate
endTime,
- isAnimationWidgetOpen: animation.active,
+ isAnimationWidgetOpen: animation.isActive,
+ animStartLocationDate: animation.startDate,
+ animEndLocationDate: animation.endDate,
axisWidth: dimensionsAndOffsetValues.width,
selectedDate: selectedDate,
timeScale: timeScaleFromNumberKey[selectedZoom.toString()],
@@ -369,7 +388,13 @@ const mapDispatchToProps = dispatch => ({
// changes to non-custom timescale interval, sets customSelected to FALSE
selectInterval: (delta, timeScale, customSelected) => {
dispatch(selectInterval(delta, timeScale, customSelected));
- }
+ },
+ openAnimation: () => {
+ dispatch(openAnimation());
+ },
+ closeAnimation: () => {
+ dispatch(closeAnimation());
+ },
// set currently selected delta - will always be 1 if !customSelected
// selectDelta: val => {
// dispatch(selectDelta(val));
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 1eacdc6cb..438bb0136 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -1,4 +1,4 @@
-import 'jquery-ui-bundle/jquery-ui';
+
import lodashFindIndex from 'lodash/findIndex';
import lodashEach from 'lodash/each';
import lodashForOwn from 'lodash/forOwn';
diff --git a/web/js/modules/animation/actions.js b/web/js/modules/animation/actions.js
index 0a3ce27a3..a1353c382 100644
--- a/web/js/modules/animation/actions.js
+++ b/web/js/modules/animation/actions.js
@@ -1,4 +1,5 @@
import {
+ OPEN_ANIMATION,
EXIT_ANIMATION,
PLAY_ANIMATION,
STOP_ANIMATION,
@@ -8,6 +9,11 @@ import {
UPDATE_END_DATE
} from './constants';
+export function onActivate() {
+ return {
+ type: OPEN_ANIMATION
+ };
+}
export function onClose() {
return {
type: EXIT_ANIMATION
diff --git a/web/js/modules/animation/constants.js b/web/js/modules/animation/constants.js
index 4204513dc..0b7dcc72c 100644
--- a/web/js/modules/animation/constants.js
+++ b/web/js/modules/animation/constants.js
@@ -1,3 +1,4 @@
+export const OPEN_ANIMATION = 'ANIMATION/OPEN_ANIMATION';
export const EXIT_ANIMATION = 'ANIMATION/EXIT_ANIMATION';
export const PLAY_ANIMATION = 'ANIMATION/PLAY_ANIMATION';
export const STOP_ANIMATION = 'ANIMATION/STOP_ANIMATION';
diff --git a/web/js/modules/animation/reducers.js b/web/js/modules/animation/reducers.js
index a994aed5f..9d1c8a9a7 100644
--- a/web/js/modules/animation/reducers.js
+++ b/web/js/modules/animation/reducers.js
@@ -1,6 +1,7 @@
import { assign as lodashAssign } from 'lodash';
import util from '../../util/util';
import {
+ OPEN_ANIMATION,
EXIT_ANIMATION,
PLAY_ANIMATION,
STOP_ANIMATION,
@@ -25,6 +26,10 @@ export function getInitialState(config) {
export function animationReducer(state = defaultState, action) {
switch (action.type) {
+ case OPEN_ANIMATION:
+ return lodashAssign({}, state, {
+ isActive: true
+ });
case EXIT_ANIMATION:
return lodashAssign({}, state, {
isActive: false
diff --git a/web/js/modules/date/reducers.js b/web/js/modules/date/reducers.js
index cea8257ff..03a54daf7 100644
--- a/web/js/modules/date/reducers.js
+++ b/web/js/modules/date/reducers.js
@@ -42,7 +42,6 @@ export function dateReducer(state = defaultState, action) {
// delta: action.value
// });
case SELECT_DATE:
- console.log(action.value)
return lodashAssign({}, state, {
[action.activeString]: action.value
});