Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

clear play interval

Benjamin Kinga68eea13a034
diff --git a/web/js/components/animation-widget/play-queue.js b/web/js/components/animation-widget/play-queue.js
index 85ffae7f2..c56963a1e 100644
--- a/web/js/components/animation-widget/play-queue.js
+++ b/web/js/components/animation-widget/play-queue.js
@@ -443,11 +443,14 @@ class PlayAnimation extends React.Component {
return promiseImageryForTime(date, activeLayers);
})
.then(date => {
- this.preloadObject[strDate] = date;
- delete this.inQueueObject[strDate];
- this.shiftCache();
- this.checkQueue(this.queueLength, this.currentPlayingDate);
- this.checkShouldPlay();
+ console.log('playing: ' + this.props.isPlaying);
+ if (this.props.isPlaying) {
+ this.preloadObject[strDate] = date;
+ delete this.inQueueObject[strDate];
+ this.shiftCache();
+ this.checkQueue(this.queueLength, this.currentPlayingDate);
+ this.checkShouldPlay();
+ }
});
}
/*
@@ -508,6 +511,10 @@ class PlayAnimation extends React.Component {
this.shiftCache();
return this.checkQueue(queueLength, this.currentPlayingDate);
}
+ if (!this.props.isPlaying) {
+ clearInterval(this.interval);
+ this.setState({ isPlaying: false });
+ }
this.checkQueue(queueLength, this.currentPlayingDate);
this.interval = setTimeout(player, 1000 / this.props.speed);
};
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index 03fa99a6d..542340fee 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -183,6 +183,7 @@ class AnimationWidget extends React.Component {
<PlayQueue
endDate={endDate}
loop={looping}
+ isPlaying={isPlaying}
currentDate={currentDate}
canPreloadAll={queueLength <= maxLength}
startDate={startDate}
@@ -200,7 +201,7 @@ class AnimationWidget extends React.Component {
onClose={onPushPause}
/>
) : (
- ''
+ null
)}
<div
id="wv-animation-widget"