Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2844: Autoplay Animations (#4670)

Ryan Weiler2fef351ff498
diff --git a/web/js/containers/animation-widget/animation-widget.js b/web/js/containers/animation-widget/animation-widget.js
index ee758a847..423e9c11a 100644
--- a/web/js/containers/animation-widget/animation-widget.js
+++ b/web/js/containers/animation-widget/animation-widget.js
@@ -35,7 +35,6 @@ import {
changeEndDate,
changeStartAndEndDate,
toggleAnimationCollapse,
- toggleAnimationAutoplay,
} from '../../modules/animation/actions';
import usePrevious from '../../util/customHooks';
import DesktopAnimationWidget from './desktop-animation-widget';
@@ -76,7 +75,6 @@ function AnimationWidget (props) {
onPushPause,
onPushPlay,
onSlide,
- onToggleAnimationAutoplay,
onToggleAnimationCollapse,
onUpdateEndDate,
onUpdateStartDate,
@@ -109,19 +107,14 @@ function AnimationWidget (props) {
onToggleAnimationCollapse();
};
- const toggleAutoplay = () => {
- onToggleAnimationAutoplay();
- };
-
// component did mount
useEffect(() => {
if (isEmbedModeActive) {
setWidgetPosition({ x: 10, y: 0 });
toggleCollapse();
}
- if (!isPlaying && autoplay && !isKioskModeActive) {
+ if (!isPlaying && autoplay) {
onPushPlay();
- toggleAutoplay();
}
}, []);
@@ -313,6 +306,7 @@ function AnimationWidget (props) {
: (
<DesktopAnimationWidget
animationCustomModalOpen={animationCustomModalOpen}
+ autoplay={autoplay}
customModalType={customModalType}
isDistractionFreeModeActive={isDistractionFreeModeActive}
endDate={endDate}
@@ -517,9 +511,6 @@ const mapDispatchToProps = (dispatch) => ({
onToggleAnimationCollapse: () => {
dispatch(toggleAnimationCollapse());
},
- onToggleAnimationAutoplay: () => {
- dispatch(toggleAnimationAutoplay());
- },
});
AnimationWidget.propTypes = {
@@ -551,7 +542,6 @@ AnimationWidget.propTypes = {
minDate: PropTypes.object,
numberOfFrames: PropTypes.number,
onToggleAnimationCollapse: PropTypes.func,
- onToggleAnimationAutoplay: PropTypes.func,
onClose: PropTypes.func,
onPushLoop: PropTypes.func,
onPushPause: PropTypes.func,
diff --git a/web/js/containers/animation-widget/desktop-animation-widget.js b/web/js/containers/animation-widget/desktop-animation-widget.js
index 60d14f3e7..0d562ed81 100644
--- a/web/js/containers/animation-widget/desktop-animation-widget.js
+++ b/web/js/containers/animation-widget/desktop-animation-widget.js
@@ -12,11 +12,13 @@ import CustomIntervalSelector from '../../components/timeline/custom-interval-se
function DesktopAnimationWidget(props) {
const {
animationCustomModalOpen,
+ autoplay,
customModalType,
endDate,
handleDragStart,
hasSubdailyLayers,
interval,
+ isDistractionFreeModeActive,
isPlaying,
looping,
maxDate,
@@ -47,6 +49,8 @@ function DesktopAnimationWidget(props) {
onSlide(speed);
};
+ const hideWidget = autoplay || isDistractionFreeModeActive ? 'd-none' : '';
+
return (
<Draggable
bounds="body"
@@ -56,7 +60,7 @@ function DesktopAnimationWidget(props) {
onDrag={onExpandedDrag}
onStart={handleDragStart}
>
- <div className="wv-animation-widget-wrapper">
+ <div className={`wv-animation-widget-wrapper ${hideWidget}`}>
<div
id="wv-animation-widget"
className={`wv-animation-widget${subDailyMode ? ' subdaily' : ''}`}
@@ -101,7 +105,6 @@ function DesktopAnimationWidget(props) {
/>
</div>
<span className="wv-slider-label mt-1">
-
{speed}
{' '}
{sliderLabel}
@@ -122,7 +125,6 @@ function DesktopAnimationWidget(props) {
subDailyMode={subDailyMode}
isDisabled={isPlaying}
/>
-
<FontAwesomeIcon icon="chevron-down" className="wv-minimize" onClick={toggleCollapse} />
<FontAwesomeIcon icon="times" className="wv-close" onClick={onClose} />
</div>
@@ -133,11 +135,13 @@ function DesktopAnimationWidget(props) {
DesktopAnimationWidget.propTypes = {
animationCustomModalOpen: PropTypes.bool,
+ autoplay: PropTypes.bool,
customModalType: PropTypes.object,
endDate: PropTypes.object,
handleDragStart: PropTypes.func,
hasSubdailyLayers: PropTypes.bool,
interval: PropTypes.string,
+ isDistractionFreeModeActive: PropTypes.bool,
isPlaying: PropTypes.bool,
looping: PropTypes.bool,
maxDate: PropTypes.object,