Interactive interface for browsing global, full-resolution satellite imagery
wip debug animation location, add anim dragger update
Edward Plato15e012268225
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.jsindex 1c39f4dce..dd3b74670 100644--- a/web/js/components/timeline/timeline-axis/timeline-axis.js+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js@@ -1215,10 +1215,12 @@ class TimelineAxis extends React.Component {}let gridWidthCoefRemainder = gridWidthCoef - Math.floor(gridWidthCoef);let remainderMilliseconds = daysCount * 86400000 * gridWidthCoefRemainder;- return draggerDateAdded.clone().add(remainderMilliseconds).format();+ let newLocationDate = draggerDateAdded.clone().add(remainderMilliseconds).format();+ return new Date(newLocationDate);} else {let draggerTimeStartValue = moment.utc(animLocationDate).valueOf();- return moment.utc(draggerTimeStartValue + (diffFactor * deltaX)).format();+ let newLocationDate = moment.utc(draggerTimeStartValue + (diffFactor * deltaX)).format();+ return new Date(newLocationDate);}}@@ -1306,7 +1308,6 @@ class TimelineAxis extends React.Component {animationEndLocation: endLocation,showHoverLine: false,showDraggerTime: false-}, function() {this.props.updateAnimationRange(animationStartLocationDate, animationEndLocationDate);});diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.jsindex b859fc77f..8cd46399c 100644--- a/web/js/containers/animation-widget.js+++ b/web/js/containers/animation-widget.js@@ -9,7 +9,7 @@ import LoopButton from '../components/animation-widget/loop-button';import PlayButton from '../components/animation-widget/play-button';import AnimWidgetHeader from '../components/animation-widget/header';import googleTagManager from 'googleTagManager';-import { hasSubDaily as hasSubDailySelector } from '../modules/layers/selectors';+import { hasSubDaily as hasSubDailySelector, lastDate as layersLastDateTime } from '../modules/layers/selectors';import {play,onClose,@@ -214,18 +214,26 @@ class AnimationWidget extends React.Component {}}function mapStateToProps(state) {- const { layers, compare, animation, date, sidebar, modal } = state;+ const { config, layers, compare, animation, date, sidebar, modal } = state;const { startDate, endDate, speed, loop, isPlaying, isActive } = animation;- const { minDate, maxDate } = date;- const activeStr = compare.activeString;- const hasSubdailyLayers = hasSubDailySelector(layers[activeStr]);+ const { activeString } = compare;+ const hasSubdailyLayers = hasSubDailySelector(layers[activeString]);const zoomObj = getZoomObject(date, hasSubdailyLayers);+ const compareModeActive = compare.active;++ let minDate = new Date(config.startDate);+ let maxDate;+ if (compareModeActive) {+ maxDate = getEndTime(layers, config);+ } else {+ maxDate = layersLastDateTime(layers[activeString], config);+ }return {startDate,endDate,- // minDate,- // maxDate,+ minDate,+ maxDate,isActive:isActive &&sidebar.activeTab !== 'download' && // No Animation when data download is active@@ -321,3 +329,9 @@ const getZoomObject = function(dateModel, hasSubDaily) {array: lodashWithout(zooms, headerText)};};++const getEndTime = (layers, config) => {+ const endDateA = layersLastDateTime(layers['active'], config);+ const endDateB = layersLastDateTime(layers['activeB'], config);+ return endDateA > endDateB ? endDateA : endDateB;+};diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.jsindex 8f46b26bc..9b760eb80 100644--- a/web/js/containers/timeline/timeline.js+++ b/web/js/containers/timeline/timeline.js@@ -22,7 +22,12 @@ import {} from '../../modules/layers/selectors';import { selectDate, changeTimeScale, selectInterval, changeCustomInterval } from '../../modules/date/actions';import { toggleActiveCompareState } from '../../modules/compare/actions';-import { onActivate as openAnimation, onClose as closeAnimation } from '../../modules/animation/actions';+import {+ onActivate as openAnimation,+ onClose as closeAnimation,+ changeStartDate,+ changeEndDate+} from '../../modules/animation/actions';import { timeScaleFromNumberKey, timeScaleToNumberKey } from '../../modules/date/constants';const ANIMATION_DELAY = 500;@@ -179,8 +184,8 @@ class Timeline extends React.Component {// update range of animation draggersupdateAnimationRange = (startDate, endDate) => {- // ! PLACE HOLDER - OLD VERSION- // ui.anim.rangeselect.updateRange(startDate, endDate, true);+ this.props.changeStartDate(startDate);+ this.props.changeEndDate(endDate);};// handles left/right arrow down to decrement/increment date@@ -451,6 +456,12 @@ const mapDispatchToProps = dispatch => ({},toggleActiveCompareState: () => {dispatch(toggleActiveCompareState());+ },+ changeStartDate: (date) => {+ dispatch(changeStartDate(date));+ },+ changeEndDate: (date) => {+ dispatch(changeEndDate(date));}});diff --git a/web/js/location.js b/web/js/location.jsindex adad0db20..994ecb1b3 100644--- a/web/js/location.js+++ b/web/js/location.js@@ -159,6 +159,7 @@ const getParameters = function(config, parameters) {options: {serializeNeedsGlobalState: true,serialize: (currentItemState, state) => {+ console.log(currentItemState, state)const isCustomSelected = get(state, 'date.customSelected');if (!isCustomSelected) return undefined;return currentItemState.toString();@@ -183,6 +184,41 @@ const getParameters = function(config, parameters) {}}},+ ae: {+ stateKey: 'animation.endDate',+ initialState: now,+ options: {+ serializeNeedsGlobalState: true,+ serialize: (currentItemState, state) => {+ console.log(currentItemState, state)++ // startDate: util.dateAdd(new Date(), 'day', -7),+ // endDate: new Date()++ return serializeDate(+ currentItemState+ );+ },+ parse: str => {+ return tryCatchDate(str, now);+ }+ }+ },+ // ae: {+ // stateKey: 'animation.endDate',+ // initialState: undefined,+ // options: {+ // serializeNeedsGlobalState: true,+ // serialize: (currentItemState, state) => {+ // return serializeDate(+ // currentItemState+ // );+ // },+ // parse: str => {+ // return tryCatchDate(str, undefined);+ // }+ // }+ // },e: {stateKey: 'events',type: 'object',diff --git a/web/js/modules/animation/reducers.js b/web/js/modules/animation/reducers.jsindex 9d1c8a9a7..c149f6b52 100644--- a/web/js/modules/animation/reducers.js+++ b/web/js/modules/animation/reducers.js@@ -15,13 +15,18 @@ const defaultState = {isActive: false,isPlaying: false,loop: false,- speed: 3+ speed: 3,+ startDate: util.dateAdd(new Date(), 'day', -7),+ endDate: new Date()};+// export function getInitialState(config) {+// return lodashAssign({}, defaultState, {+// startDate: util.dateAdd(new Date(), 'day', -7),+// endDate: new Date()+// });+// }export function getInitialState(config) {- return lodashAssign({}, defaultState, {- startDate: util.dateAdd(new Date(), 'day', -7),- endDate: new Date()- });+ return lodashAssign({}, defaultState);}export function animationReducer(state = defaultState, action) {