Interactive interface for browsing global, full-resolution satellite imagery
make animation widget collapsable
Jason Kent3be0b08adaba
diff --git a/web/css/anim.widget.css b/web/css/anim.widget.cssindex 69bbfab94..bc0b2cfd3 100644--- a/web/css/anim.widget.css+++ b/web/css/anim.widget.css@@ -1,7 +1,24 @@.wv-animation-widget-wrapper {position: absolute;- bottom: 125px;+ bottom: 88px;left: 40%;+ z-index: 100;+ &.minimized {+ bottom: 80px;+ left: 242px;+ &.subdaily {+ left: 347px;+ }+ }+}+.wv-animation-widget-wrapper-minimized {+ position: absolute;+ z-index: 100;+ bottom: 80px;+ left: 242px;+ &.subdaily {+ left: 347px;+ }}.wv-animation-widget {width: 334px;@@ -11,9 +28,13 @@color: #fff;padding: 1px 0;cursor: move;+ &.minimized {+ height: 52px;+ width: 80px;+ background: rgba(40, 40, 40, 0.85);+ }& .wv-animation-widget-header {display: block;- text-align: center;margin-bottom: 10px;text-transform: capitalize;& .interval-btn-container,@@ -23,7 +44,7 @@}& .wv-tooltip {bottom: 128px;- left: 44%;+ left: 27%;position: absolute;border-bottom: 8px solid transparent;width: 100px;@@ -56,12 +77,19 @@}&.subdaily {width: 460px;+ & .wv-animation-widget-header {+ display: block;+ text-align: center;+ }& .input-range {width: 278px;}& .custom-interval-widget {left: 113px;}+ & .wv-tooltip {+ left: 44%;+ }}& .wv-slider-case {padding-right: 3px;@@ -86,8 +114,16 @@& i.fa {position: absolute;&.wv-close {- top: 5px;- right: 7px;+ top: 9px;+ right: 9px;+ }+ &.wv-minimize {+ top: 9px;+ right: 29px;+ }+ &.wv-expand {+ right: 8px;+ bottom: 9px;}&:hover {color: #999;diff --git a/web/css/timeline.css b/web/css/timeline.cssindex aa315c02c..36fa5d81a 100644--- a/web/css/timeline.css+++ b/web/css/timeline.css@@ -193,7 +193,7 @@ button:focus {}& .animate-button {- margin-top: 10px;+ margin: 10px 0 0 10px;height: 40px;width: 40px;}diff --git a/web/css/tooltip.css b/web/css/tooltip.cssindex 9605fee6d..2ba55aa05 100644--- a/web/css/tooltip.css+++ b/web/css/tooltip.css@@ -60,6 +60,8 @@white-space: nowrap;user-select: none;padding-left: 8px;+ position: relative;+ z-index: 101;}.date-tooltip-day {diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.jsindex ce20e1092..0ed5ebec7 100644--- a/web/js/containers/animation-widget.js+++ b/web/js/containers/animation-widget.js@@ -92,7 +92,9 @@ class AnimationWidget extends React.Component {isSliding: false,isGifActive: false,hoverGif: false,- customIntervalModalOpen: false+ customIntervalModalOpen: false,+ collapsed: false,+ collapsedWidgePosition: { x: 0, y: 0 }};this.onDateChange = this.onDateChange.bind(this);this.onIntervalSelect = this.onIntervalSelect.bind(this);@@ -100,6 +102,8 @@ class AnimationWidget extends React.Component {this.openGif = this.openGif.bind(this);this.toggleHoverGif = this.toggleHoverGif.bind(this);this.handleDragStart = this.handleDragStart.bind(this);+ this.toggleCollapse = this.toggleCollapse.bind(this);+ this.onCollapsedDrag = this.onCollapsedDrag.bind(this);}static getDerivedStateFromProps(props, state) {@@ -108,6 +112,12 @@ class AnimationWidget extends React.Component {} else return null;}+ toggleCollapse() {+ this.setState({+ collapsed: !this.state.collapsed+ });+ }+/*** Prevent drag when interacting with child elements (e.g. buttons)* Only allow drag when targeting "background" elements@@ -125,6 +135,11 @@ class AnimationWidget extends React.Component {return draggableTargets.some(tClass => classList.contains(tClass));}+ onCollapsedDrag(e, position) {+ const { x, y } = position;+ this.setState({ collapsedWidgePosition: { x, y } });+ };+getPromise(bool, type, action, title) {const { notify } = this.props;if (bool) {@@ -364,12 +379,71 @@ class AnimationWidget extends React.Component {hasSubdailyLayers} = this.props;+ const { speed, collapsed } = this.state;+if (!isActive) {return null;}if (isGifActive) {return <GifContainer onClose={toggleGif} />;}+ if (collapsed) {+ const maxLength = getMaxQueueLength(speed);+ const queueLength = getQueueLength(+ startDate,+ endDate,+ speed,+ interval,+ delta+ );++ return (+ <ErrorBoundary>+ {isPlaying && (+ <PlayQueue+ endDate={endDate}+ loop={looping}+ isPlaying={isPlaying}+ currentDate={currentDate}+ canPreloadAll={queueLength <= maxLength}+ startDate={startDate}+ hasCustomPalettes={hasCustomPalettes}+ map={map}+ maxQueueLength={maxLength}+ queueLength={queueLength}+ layers={layers}+ interval={interval}+ delta={delta}+ speed={speed}+ selectDate={selectDate}+ togglePlaying={onPushPause}+ promiseImageryForTime={promiseImageryForTime}+ onClose={onPushPause}+ />+ )}+ <Draggable+ bounds="body"+ onStart={this.handleDragStart}+ position={this.state.collapsedWidgePosition}+ onDrag={this.onCollapsedDrag}>+ <div id="wv-anim-minimized" className={'wv-animation-widget-wrapper-minimized' + (hasSubdailyLayers ? ' subdaily' : '')}>+ <div+ id="wv-animation-widget"+ className={'wv-animation-widget minimized'}>+ <PlayButton+ playing={isPlaying}+ play={this.onPushPlay}+ pause={onPushPause}+ />+ <i className="fa fa-external-link-square-alt wv-expand" onClick={this.toggleCollapse} />+ <i className="fa fa-times wv-close" onClick={this.props.onClose} />+ </div>+ </div>+ </Draggable>+ </ErrorBoundary>+ );+ }+const maxLength = getMaxQueueLength(this.state.speed);const queueLength = getQueueLength(startDate,@@ -397,7 +471,7 @@ class AnimationWidget extends React.Component {layers={layers}interval={interval}delta={delta}- speed={this.state.speed}+ speed={speed}selectDate={selectDate}togglePlaying={onPushPause}promiseImageryForTime={promiseImageryForTime}@@ -405,7 +479,7 @@ class AnimationWidget extends React.Component {/>)}<Draggable bounds="body" onStart={this.handleDragStart}>- <div className="wv-animation-widget-wrapper">+ <div id="wv-anim-widget" className="wv-animation-widget-wrapper"><divid="wv-animation-widget"className={'wv-animation-widget' + (subDailyMode ? ' subdaily' : '')}@@ -491,6 +565,8 @@ class AnimationWidget extends React.Component {subDailyMode={subDailyMode}/></div>++ <i className="fa fa-minus wv-minimize" onClick={this.toggleCollapse} /><i className="fa fa-times wv-close" onClick={this.props.onClose} />{/* Custom time interval selection */}@@ -721,6 +797,7 @@ AnimationWidget.propTypes = {speed: PropTypes.number,startDate: PropTypes.object,subDailyMode: PropTypes.bool,+ toggleCollapse: PropTypes.func,toggleCustomModal: PropTypes.func,toggleGif: PropTypes.func};