Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Set animation state properly with setState

ZachTRicef97dcea319b0
diff --git a/config/default/common/config/wv.json/stories.json b/config/default/common/config/wv.json/stories.json
index 4e5855e70..515408da0 100644
--- a/config/default/common/config/wv.json/stories.json
+++ b/config/default/common/config/wv.json/stories.json
@@ -36,7 +36,7 @@
"element": "animation",
"action": "play"
},
- "stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor,MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor(hidden),Reference_Labels,Reference_Features(hidden),Coastlines(hidden)&t=2018-09-02-T00%3A00%3A00Z&z=3&t1=2018-09-19-T00%3A00%3A00Z&v=-113.05825121261012,-7.7039155910611115,-10.61293871261011,58.24920940893889&ab=on&as=2018-09-02T00%3A00%3A00Z&ae=2018-09-14T00%3A00%3A00Z&av=10&al=false"
+ "stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor,MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor(hidden),Reference_Labels,Reference_Features(hidden),Coastlines(hidden)&t=2018-09-02-T00%3A00%3A00Z&z=3&t1=2018-09-19-T00%3A00%3A00Z&v=-113.05825121261012,-7.7039155910611115,-10.61293871261011,58.24920940893889&ab=on&as=2018-09-02T00%3A00%3A00Z&ae=2018-09-14T00%3A00%3A00Z&av=8&al=false"
},
{
"description": "step004.html",
@@ -44,7 +44,7 @@
"element": "",
"action": ""
},
- "stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor,MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor(hidden),Reference_Labels,Reference_Features(hidden),Coastlines(hidden)&t=2018-09-14-T00%3A00%3A00Z&z=3&t1=2018-09-19-T00%3A00%3A00Z&v=-105.3766105876101,15.639834408938874,-54.1539543376101,48.616396908938874&ab=on&as=2018-09-02T00%3A00%3A00Z&ae=2018-09-14T00%3A00%3A00Z&av=10&al=false"
+ "stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor,MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor(hidden),Reference_Labels,Reference_Features(hidden),Coastlines(hidden)&t=2018-09-14-T00%3A00%3A00Z&z=3&t1=2018-09-19-T00%3A00%3A00Z&v=-105.3766105876101,15.639834408938874,-54.1539543376101,48.616396908938874&ab=on&as=2018-09-02T00%3A00%3A00Z&ae=2018-09-14T00%3A00%3A00Z&av=8&al=false"
},
{
"description": "step005.html",
@@ -52,7 +52,7 @@
"element": "animation",
"action": "play"
},
- "stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor,MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor(hidden),Reference_Labels,Reference_Features(hidden),Coastlines(hidden)&t=2018-09-14-T00%3A00%3A00Z&z=3&t1=2018-09-19-T00%3A00%3A00Z&v=-105.3766105876101,15.639834408938874,-54.1539543376101,48.616396908938874&ab=on&as=2018-09-14T00%3A00%3A00Z&ae=2018-09-30T00%3A00%3A00Z&av=10&al=true"
+ "stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor,MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor(hidden),Reference_Labels,Reference_Features(hidden),Coastlines(hidden)&t=2018-09-14-T00%3A00%3A00Z&z=3&t1=2018-09-19-T00%3A00%3A00Z&v=-105.3766105876101,15.639834408938874,-54.1539543376101,48.616396908938874&ab=on&as=2018-09-14T00%3A00%3A00Z&ae=2018-09-20T00%3A00%3A00Z&av=2&al=true"
},
{
"description": "step006.html",
diff --git a/web/js/components/tour/modal-tour-in-progress.js b/web/js/components/tour/modal-tour-in-progress.js
index b89e3ff28..fcee0cee1 100644
--- a/web/js/components/tour/modal-tour-in-progress.js
+++ b/web/js/components/tour/modal-tour-in-progress.js
@@ -139,7 +139,6 @@ class ModalInProgress extends React.Component {
var config = this.props.config;
var models = this.props.models;
var ui = this.props.ui;
- var animation = {};
// var layersLoaded = false;
// var map = ui.map.selected;
@@ -178,16 +177,25 @@ class ModalInProgress extends React.Component {
// Animation*
// * Seems like this must come before comparison
if (currentState.al) {
- ui.anim.widget.reactComponent.state.looping = true;
+ ui.anim.widget.reactComponent.setState({ looping: true });
} else {
- ui.anim.widget.reactComponent.state.looping = false;
+ ui.anim.widget.reactComponent.setState({ looping: false });
}
- if (currentState.as) ui.anim.widget.reactComponent.state.startDate = currentState.as;
- if (currentState.ae) ui.anim.widget.reactComponent.state.endDate = currentState.ae;
- if (currentState.av) ui.anim.widget.reactComponent.state.value = Number(currentState.av);
+ if (currentState.as) ui.anim.widget.reactComponent.setState({ startDate: currentState.as });
+ if (currentState.ae) ui.anim.widget.reactComponent.setState({ endDate: currentState.ae });
+ if (currentState.av) ui.anim.widget.reactComponent.setState({ value: Number(currentState.av) });
+
+ // This has to be set before the animation widget is toggled
+ // if (stepTransition) {
+ // if (stepTransition.element === 'animation' && stepTransition.action === 'play') {
+ // ui.anim.widget.reactComponent.state.playing = true;
+ // } else {
+ // ui.anim.widget.reactComponent.state.playing = false;
+ // }
+ // }
if (prevState.ab === 'on' && currentState.ab === 'off') {
- models.anim.activate();
+ models.anim.ctivate();
ui.anim.widget.toggleAnimationWidget();
} else
if (prevState.ab === 'on' && !currentState.ab) {
@@ -272,11 +280,11 @@ class ModalInProgress extends React.Component {
// Step Transistions: Animation
if (stepTransition) {
if (stepTransition.element === 'animation' && stepTransition.action === 'play') {
- animation.playing = true;
ui.anim.widget.onPressPlay();
+ ui.anim.widget.reactComponent.setState({ playing: true });
} else {
- animation.playing = false;
ui.anim.widget.onPressPause();
+ ui.anim.widget.reactComponent.setState({ playing: false });
}
}