Interactive interface for browsing global, full-resolution satellite imagery
merge changes
Edward Platoa347b21397ea
diff --cc web/js/containers/timeline/timeline.jsindex 4219b8815,1940e0318..efb080868--- a/web/js/containers/timeline/timeline.js+++ b/web/js/containers/timeline/timeline.js@@@ -513,8 -527,31 +513,29 @@@ class Timeline extends React.ComponentdraggerVisibleB});}+ static getDerivedStateFromProps(props, currentState) {+ // Update animation Date states when animation is initiated+ if (!currentState.animationEndLocationDate && !currentState.animationStartLocationDate && props.animStartLocationDate && props.animEndLocationDate) {+ let { position, transformX } = currentState;+ let { timeScale } = props;+ let startDate = props.animStartLocationDate;+ let endDate = props.animEndLocationDate;+ let options = timeScaleOptions[timeScale].timeAxis;+ let gridWidth = options.gridWidth;+ let frontDate = moment.utc(currentState.frontDate);+ let startLocation = frontDate.diff(startDate, timeScale, true) * gridWidth;+ let endLocation = frontDate.diff(endDate, timeScale, true) * gridWidth;+ return {+ animationStartLocationDate: props.animStartLocationDate,+ animationEndLocationDate: props.animEndLocationDate,+ animationStartLocation: position - startLocation + transformX,+ animationEndLocation: position - endLocation + transformX+ };+ }+ return null;+ }componentDidUpdate(prevProps, prevState) {- // console.log(prevProps, prevState)- // console.log(this.props, this.state)let prevStartLocationDate = prevProps.animStartLocationDate;let prevEndLocationDate = prevProps.animEndLocationDate;@@@ -640,250 -663,217 +660,254 @@@isAnimationWidgetOpen,animationDisabled,hideTimeline,- timeScale+ timeScale,+ isSmallScreen,+ toggleActiveCompareState,+ parentOffset} = this.props;- let selectedDate = draggerSelected === 'selected' ? this.state.draggerTimeState : this.state.draggerTimeStateB;- return this.state.initialLoadComplete ? (- <ErrorBoundary>- {this.props.isSmallScreen- ? <MobileDatePicker- date={selectedDate}- startDateLimit={timelineStartDateLimit}- endDateLimit={timelineEndDateLimit}- hasSubdailyLayers={this.props.hasSubdailyLayers}- onDateChange={this.onDateChange}- />- : <section id="timeline" className="timeline-inner clearfix">- <div id="timeline-header"- className={hasSubdailyLayers ? 'subdaily' : ''}- >- <div id="date-selector-main">- <DateSelector- onDateChange={this.onDateChange}- date={new Date(selectedDate)}- hasSubdailyLayers={hasSubdailyLayers}- draggerSelected={draggerSelected}- maxDate={new Date(timelineEndDateLimit)}- minDate={new Date(timelineStartDateLimit)}- fontSize={24}- />- </div>- <div id="zoom-buttons-group">- <TimeScaleIntervalChange- setTimeScaleIntervalChangeUnit={this.setTimeScaleIntervalChangeUnit}- customIntervalZoomLevel={timeScaleFromNumberKey[customIntervalZoomLevel]}- customSelected={customSelected}- customDelta={customIntervalValue}- timeScaleChangeUnit={timeScaleChangeUnit}- />- <DateChangeArrows- leftArrowDown={this.decrementDate}- leftArrowUp={this.stopper}- leftArrowDisabled={leftArrowDisabled}- rightArrowDown={this.incrementDate}- rightArrowUp={this.stopper}- rightArrowDisabled={rightArrowDisabled}- />- </div>- <AnimationButton- disabled={animationDisabled}- clickAnimationButton={this.clickAnimationButton}- />- </div>- <div id="timeline-footer"- style={{- display:- this.state.timelineHidden || hideTimeline ? 'none' : 'block'- }}- >- {/* Timeline */}- <TimelineAxis- frontDate={this.state.frontDate}- backDate={this.state.backDate}- isTimelineDragging={this.state.isTimelineDragging}- moved={this.state.moved}- axisWidth={axisWidth}- dateA={dateA}- dateB={dateB}+ let {+ initialLoadComplete,+ timelineHidden,+ draggerTimeState,+ draggerTimeStateB,+ draggerPosition,+ draggerPositionB,+ draggerVisible,+ draggerVisibleB,+ animationStartLocationDate,+ animationEndLocationDate,+ animationStartLocation,+ animationEndLocation,+ rangeSelectorMax,+ transformX,+ position,+ leftOffset,+ hoverTime,+ frontDate,+ backDate,+ isTimelineDragging,+ isDraggerDragging,+ isAnimationDraggerDragging,+ customIntervalModalOpen,+ showHoverLine,+ showDraggerTime,+ hoverLinePosition,+ moved+ } = this.state;+ let selectedDate = draggerSelected === 'selected' ? draggerTimeState : draggerTimeStateB;+ return (+ <div className="timeline-container">+ {initialLoadComplete+ ? <ErrorBoundary>+ {isSmallScreen+ ? <MobileDatePicker+ date={selectedDate}+ startDateLimit={timelineStartDateLimit}+ endDateLimit={timelineEndDateLimit}hasSubdailyLayers={hasSubdailyLayers}- changeTimeScale={this.changeTimeScale}- compareModeActive={compareModeActive}- draggerSelected={draggerSelected}- onChangeSelectedDragger={this.props.toggleActiveCompareState}- timelineStartDateLimit={timelineStartDateLimit}- timelineEndDateLimit={timelineEndDateLimit}- animStartLocationDate={animStartLocationDate}- animEndLocationDate={animEndLocationDate}- isAnimationDraggerDragging={this.state.isAnimationDraggerDragging}- updateDraggerDatePosition={this.updateDraggerDatePosition}- draggerTimeState={this.state.draggerTimeState}- draggerTimeStateB={this.state.draggerTimeStateB}- // draggerTimeState={dateA}- // draggerTimeStateB={dateB}- draggerPosition={this.state.draggerPosition}- draggerPositionB={this.state.draggerPositionB}- draggerVisible={this.state.draggerVisible}- draggerVisibleB={this.state.draggerVisibleB}- transformX={this.state.transformX}- updatePositioning={this.updatePositioning}- position={this.state.position}- animationStartLocation={this.state.animationStartLocation}- animationEndLocation={this.state.animationEndLocation}- timeScale={timeScale}- showHoverOn={this.showHoverOn}- showHoverOff={this.showHoverOff}- showHover={this.showHover}- leftOffset={this.state.leftOffset}- hoverTime={this.state.hoverTime}- isDraggerDragging={this.state.isDraggerDragging}- parentOffset={this.props.parentOffset}+ onDateChange={this.onDateChange}/>+ : <section id="timeline" className="timeline-inner clearfix">+ <div id="timeline-header"+ className={hasSubdailyLayers ? 'subdaily' : ''}+ >+ <div id="date-selector-main">+ <DateSelector+ onDateChange={this.onDateChange}+ date={new Date(selectedDate)}+ hasSubdailyLayers={hasSubdailyLayers}+ draggerSelected={draggerSelected}+ maxDate={new Date(timelineEndDateLimit)}+ minDate={new Date(timelineStartDateLimit)}+ fontSize={24}+ />+ </div>+ <div id="zoom-buttons-group">+ <TimeScaleIntervalChange+ setTimeScaleIntervalChangeUnit={this.setTimeScaleIntervalChangeUnit}+ customIntervalZoomLevel={timeScaleFromNumberKey[customIntervalZoomLevel]}+ customSelected={customSelected}+ customDelta={customIntervalValue}+ timeScaleChangeUnit={timeScaleChangeUnit}+ />+ <DateChangeArrows+ leftArrowDown={this.throttleDecrementDate}+ leftArrowUp={this.stopLeftArrow}+ leftArrowDisabled={leftArrowDisabled}+ rightArrowDown={this.throttleIncrementDate}+ rightArrowUp={this.stopRightArrow}+ rightArrowDisabled={rightArrowDisabled}+ />+ </div>+ <AnimationButton+ disabled={animationDisabled}+ clickAnimationButton={this.clickAnimationButton}+ />+ </div>- <HoverLine- width={axisWidth}- isTimelineDragging={this.state.isTimelineDragging}- isAnimationDraggerDragging={this.state.isAnimationDraggerDragging}- showHoverLine={this.state.showHoverLine}- hoverLinePosition={this.state.hoverLinePosition}- />+ <div id="timeline-footer"+ style={{+ display:+ timelineHidden || hideTimeline ? 'none' : 'block'+ }}+ >+ {/* Axis */}+ <TimelineAxis+ frontDate={frontDate}+ backDate={backDate}+ isTimelineDragging={isTimelineDragging}+ moved={moved}+ axisWidth={axisWidth}+ dateA={dateA}+ dateB={dateB}+ hasSubdailyLayers={hasSubdailyLayers}+ changeTimeScale={this.changeTimeScale}+ compareModeActive={compareModeActive}+ draggerSelected={draggerSelected}+ onChangeSelectedDragger={toggleActiveCompareState}+ timelineStartDateLimit={timelineStartDateLimit}+ timelineEndDateLimit={timelineEndDateLimit}+ animStartLocationDate={animStartLocationDate}+ animEndLocationDate={animEndLocationDate}+ isAnimationDraggerDragging={isAnimationDraggerDragging}+ updateDraggerDatePosition={this.updateDraggerDatePosition}+ draggerTimeState={draggerTimeState}+ draggerTimeStateB={draggerTimeStateB}+ draggerPosition={draggerPosition}+ draggerPositionB={draggerPositionB}+ draggerVisible={draggerVisible}+ draggerVisibleB={draggerVisibleB}+ transformX={transformX}+ updatePositioning={this.updatePositioning}+ position={position}+ animationStartLocation={animationStartLocation}+ animationEndLocation={animationEndLocation}+ timeScale={timeScale}+ showHoverOn={this.showHoverOn}+ showHoverOff={this.showHoverOff}+ showHover={this.showHover}+ leftOffset={leftOffset}+ hoverTime={hoverTime}+ isDraggerDragging={isDraggerDragging}+ parentOffset={parentOffset}+ />- {isAnimationWidgetOpen && this.state.animationStartLocation && this.state.animationStartLocationDate && this.state.animationEndLocation && this.state.animationEndLocationDate- ? <TimelineRangeSelector- position={this.state.position}- frontDate={this.state.frontDate}- isAnimationDraggerDragging={this.state.isAnimationDraggerDragging}- timeScale={timeScale}- startLocation={this.state.animationStartLocation}- endLocation={this.state.animationEndLocation}- startLocationDate={this.state.animationStartLocationDate}- endLocationDate={this.state.animationEndLocationDate}- timelineStartDateLimit={timelineStartDateLimit}- timelineEndDateLimit={timelineEndDateLimit}- updateAnimationDateAndLocation={this.updateAnimationDateAndLocation}- animationDraggerDateUpdate={this.animationDraggerDateUpdate}- max={this.state.rangeSelectorMax}- pinWidth={5}- width={axisWidth}- transformX={this.state.transformX}- rangeOpacity={0.3}- rangeColor={'#45bdff'}- startColor={'#40a9db'}- startTriangleColor={'#fff'}- endColor={'#295f92'}- endTriangleColor={'#4b7aab'} />- : null- }+ <HoverLine+ width={axisWidth}+ isTimelineDragging={isTimelineDragging}+ isAnimationDraggerDragging={isAnimationDraggerDragging}+ showHoverLine={showHoverLine}+ hoverLinePosition={hoverLinePosition}+ />- {isAnimationWidgetOpen- {this.state.frontDate- ? <DraggerContainer- position={this.state.position}- timelineStartDateLimit={timelineStartDateLimit}- timelineEndDateLimit={timelineEndDateLimit}- timeScale={timeScale}- frontDate={this.state.frontDate}- backDate={this.state.backDate}- draggerSelected={draggerSelected}- transformX={this.state.transformX}- width={axisWidth}- setDraggerVisibility={this.setDraggerVisibility}- toggleShowDraggerTime={this.toggleShowDraggerTime}- onChangeSelectedDragger={this.props.toggleActiveCompareState}- updateDraggerDatePosition={this.updateDraggerDatePosition}- compareModeActive={compareModeActive}- // draggerTimeState={dateA}- // draggerTimeStateB={dateB}- draggerTimeState={this.state.draggerTimeState}- draggerTimeStateB={this.state.draggerTimeStateB}- draggerPosition={this.state.draggerPosition}- draggerPositionB={this.state.draggerPositionB}- draggerVisible={this.state.draggerVisible}- draggerVisibleB={this.state.draggerVisibleB}- isDraggerDragging={this.state.isDraggerDragging}- />- : null }++ {isAnimationWidgetOpen &&++ this.state.animationStartLocation &&++ this.state.animationStartLocationDate &&++ this.state.animationEndLocation &&++ this.state.animationEndLocationDate+ ? <TimelineRangeSelector+ position={position}+ frontDate={frontDate}+ isAnimationDraggerDragging={isAnimationDraggerDragging}+ timeScale={timeScale}+ startLocation={animationStartLocation}+ endLocation={animationEndLocation}+ startLocationDate={animationStartLocationDate}+ endLocationDate={animationEndLocationDate}+ timelineStartDateLimit={timelineStartDateLimit}+ timelineEndDateLimit={timelineEndDateLimit}+ updateAnimationDateAndLocation={this.updateAnimationDateAndLocation}+ animationDraggerDateUpdate={this.animationDraggerDateUpdate}+ max={rangeSelectorMax}+ pinWidth={5}+ width={axisWidth}+ transformX={transformX}+ rangeOpacity={0.3}+ rangeColor={'#45bdff'}+ startColor={'#40a9db'}+ startTriangleColor={'#fff'}+ endColor={'#295f92'}+ endTriangleColor={'#4b7aab'} />+ : null+ }- {!this.state.isTimelineDragging- ? <DateToolTip- draggerSelected={draggerSelected}- draggerPosition={this.state.draggerPosition}- draggerPositionB={this.state.draggerPositionB}- hasSubdailyLayers={hasSubdailyLayers}- leftOffset={this.state.leftOffset}- showDraggerTime={this.state.showDraggerTime}- draggerTimeState={this.state.draggerTimeState}- draggerTimeStateB={this.state.draggerTimeStateB}- hoverTime={this.state.hoverTime}- showHoverLine={this.state.showHoverLine}- axisWidth={axisWidth}- />- : null- }+ {frontDate+ ? <DraggerContainer+ position={position}+ timelineStartDateLimit={timelineStartDateLimit}+ timelineEndDateLimit={timelineEndDateLimit}+ timeScale={timeScale}+ frontDate={frontDate}+ backDate={backDate}+ draggerSelected={draggerSelected}+ transformX={transformX}+ width={axisWidth}+ setDraggerVisibility={this.setDraggerVisibility}+ toggleShowDraggerTime={this.toggleShowDraggerTime}+ onChangeSelectedDragger={toggleActiveCompareState}+ updateDraggerDatePosition={this.updateDraggerDatePosition}+ compareModeActive={compareModeActive}+ draggerTimeState={draggerTimeState}+ draggerTimeStateB={draggerTimeStateB}+ draggerPosition={draggerPosition}+ draggerPositionB={draggerPositionB}+ draggerVisible={draggerVisible}+ draggerVisibleB={draggerVisibleB}+ isDraggerDragging={isDraggerDragging}+ />+ : null }- {/* custom interval selector */}- <CustomIntervalSelectorWidget- customDelta={customIntervalValue}- customIntervalZoomLevel={customIntervalZoomLevel}- toggleCustomIntervalModal={this.toggleCustomIntervalModal}- customIntervalModalOpen={this.state.customIntervalModalOpen}- changeCustomInterval={this.changeCustomInterval}- hasSubdailyLayers={hasSubdailyLayers}- />- </div>+ {!isTimelineDragging+ ? <DateToolTip+ draggerSelected={draggerSelected}+ draggerPosition={draggerPosition}+ draggerPositionB={draggerPositionB}+ hasSubdailyLayers={hasSubdailyLayers}+ leftOffset={leftOffset}+ showDraggerTime={showDraggerTime}+ draggerTimeState={draggerTimeState}+ draggerTimeStateB={draggerTimeStateB}+ hoverTime={hoverTime}+ showHoverLine={showHoverLine}+ axisWidth={axisWidth}+ />+ : null+ }- {/* Zoom Level Change */}- <AxisTimeScaleChange- isDraggerDragging={this.state.isDraggerDragging}- timelineHidden={this.state.timelineHidden}- timeScale={this.props.timeScale}- changeTimeScale={this.changeTimeScale}- hasSubdailyLayers={this.props.hasSubdailyLayers}- />+ {/* custom interval selector */}+ <CustomIntervalSelectorWidget+ customDelta={customIntervalValue}+ customIntervalZoomLevel={customIntervalZoomLevel}+ toggleCustomIntervalModal={this.toggleCustomIntervalModal}+ customIntervalModalOpen={customIntervalModalOpen}+ changeCustomInterval={this.changeCustomInterval}+ hasSubdailyLayers={hasSubdailyLayers}+ />+ </div>- {/* π Open/Close Chevron π */}- <div id="timeline-hide" onClick={this.toggleHideTimeline}>- <div- className={`wv-timeline-hide wv-timeline-hide-double-chevron-${- this.state.timelineHidden ? 'left' : 'right'- }`}- />- </div>- </section>- }- </ErrorBoundary>- ) : null;+ {/* Zoom Level Change */}+ <AxisTimeScaleChange+ isDraggerDragging={isDraggerDragging}+ timelineHidden={timelineHidden}+ timeScale={timeScale}+ changeTimeScale={this.changeTimeScale}+ hasSubdailyLayers={hasSubdailyLayers}+ />++ {/* π Open/Close Chevron π */}+ <div id="timeline-hide" onClick={this.toggleHideTimeline}>+ <div+ className={`wv-timeline-hide wv-timeline-hide-double-chevron-${+ timelineHidden ? 'left' : 'right'+ }`}+ />+ </div>+ </section>+ }+ </ErrorBoundary>+ : null }+ </div>+ );}}function mapStateToProps(state) {