Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

move draggers and tooltip to own folders, remove unused props and order for consistency, clean up variable names

Edward Platoc80660f35fa6
diff --git a/web/css/timeline.css b/web/css/timeline.css
index 87f9c3ef7..b2a802293 100644
--- a/web/css/timeline.css
+++ b/web/css/timeline.css
@@ -349,7 +349,7 @@ button:focus {
}
/* Interval selector */
-.wv-custom-interval-widget {
+.custom-interval-widget {
height: 57px;
width: 225px;
border-top-left-radius: 8px;
@@ -363,29 +363,29 @@ button:focus {
border-bottom: thin solid #444;
}
-.wv-custom-interval-widget i.wv-close {
+.custom-interval-widget i.wv-close {
position: absolute;
top: 5px;
right: 5px;
}
-.wv-custom-interval-widget i.wv-close:hover {
+.custom-interval-widget i.wv-close:hover {
color: #999;
cursor: pointer;
}
-.wv-custom-interval-widget-header,
-.wv-custom-interval-widget-controls-container {
+.custom-interval-widget-header,
+.custom-interval-widget-controls-container {
display: inline-block;
margin: 7px 0 0 10px;
}
-.wv-custom-interval-widget-controls-container {
+.custom-interval-widget-controls-container {
display: flex;
flex-direction: row;
}
-.interval-input {
+.custom-interval-delta-input {
width: 80px;
height: 24px;
color: #7890cd;
@@ -403,7 +403,7 @@ button:focus {
border: thin solid #fff;
}
-.interval-timescale-select-form-container {
+.custom-interval-timescale-select-form-container {
width: 100px;
height: 40px;
color: #7890cd;
@@ -420,7 +420,7 @@ button:focus {
text-align: center;
}
-.interval-timescale-select {
+.custom-interval-timescale-select {
padding: 0;
background: transparent;
color: #7890cd;
@@ -432,7 +432,7 @@ button:focus {
padding-left: 15px;
}
-.interval-timescale-select-option {
+.custom-interval-timescale-select-option {
background: rgb(40, 40, 40);
}
@@ -585,7 +585,7 @@ button:focus {
pointer-events: all;
}
-.timeline-hover-line-container {
+.axis-hover-line-container {
pointer-events: none;
position: absolute;
bottom: 0;
diff --git a/web/js/components/range-selection/dragger.js b/web/js/components/range-selection/dragger.js
index ff78f7ce0..86c0ccb1d 100644
--- a/web/js/components/range-selection/dragger.js
+++ b/web/js/components/range-selection/dragger.js
@@ -198,7 +198,6 @@ TimelineDragger.defaultProps = {
};
TimelineDragger.propTypes = {
- opacity: PropTypes.number,
max: PropTypes.number,
height: PropTypes.number,
onDrag: PropTypes.func,
@@ -213,8 +212,7 @@ TimelineDragger.propTypes = {
yOffset: PropTypes.number,
path: PropTypes.string,
textColor: PropTypes.string,
- text: PropTypes.string,
- onMouseDown: PropTypes.func
+ text: PropTypes.string
};
export default TimelineDragger;
diff --git a/web/js/components/range-selection/range-selection.js b/web/js/components/range-selection/range-selection.js
index 735ff9b7b..3f985c865 100644
--- a/web/js/components/range-selection/range-selection.js
+++ b/web/js/components/range-selection/range-selection.js
@@ -263,11 +263,8 @@ class TimelineRangeSelector extends React.Component {
<svg
id="wv-timeline-range-selector"
className="wv-timeline-range-selector"
- width={this.props.width}
+ width={this.props.axisWidth}
height={75}
- style={{
- left: this.props.parentOffset
- }}
>
<DraggerRange
opacity={this.props.rangeOpacity}
@@ -319,28 +316,26 @@ class TimelineRangeSelector extends React.Component {
}
TimelineRangeSelector.propTypes = {
- updateAnimationDateAndLocation: PropTypes.func,
- width: PropTypes.number,
- parentOffset: PropTypes.number,
- timeScale: PropTypes.string,
- frontDate: PropTypes.string,
+ axisWidth: PropTypes.number,
position: PropTypes.number,
transformX: PropTypes.number,
+ timeScale: PropTypes.string,
+ frontDate: PropTypes.string,
+ timelineStartDateLimit: PropTypes.string,
+ timelineEndDateLimit: PropTypes.string,
startLocation: PropTypes.number,
endLocation: PropTypes.number,
startLocationDate: PropTypes.object,
endLocationDate: PropTypes.object,
- timelineStartDateLimit: PropTypes.string,
- timelineEndDateLimit: PropTypes.string,
max: PropTypes.object,
pinWidth: PropTypes.number,
- onDrag: PropTypes.func,
rangeOpacity: PropTypes.number,
rangeColor: PropTypes.string,
startColor: PropTypes.string,
startTriangleColor: PropTypes.string,
endColor: PropTypes.string,
- endTriangleColor: PropTypes.string
+ endTriangleColor: PropTypes.string,
+ updateAnimationDateAndLocation: PropTypes.func
};
export default TimelineRangeSelector;
diff --git a/web/js/components/timeline/interval-selector/interval-input.js b/web/js/components/timeline/custom-interval-selector/delta-input.js
similarity index 73%
rename from web/js/components/timeline/interval-selector/interval-input.js
rename to web/js/components/timeline/custom-interval-selector/delta-input.js
index da59a2f12..eca77c043 100644
--- a/web/js/components/timeline/interval-selector/interval-input.js
+++ b/web/js/components/timeline/custom-interval-selector/delta-input.js
@@ -2,14 +2,14 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
/*
- * Interval Input for Custom Interval Selector
+ * Delta Input for Custom Interval Selector
* group. It is a child component.
*
- * @class IntervalInput
+ * @class DeltaInput
*/
const regex = /^[0-9\b]+$/;
-class IntervalInput extends PureComponent {
+class DeltaInput extends PureComponent {
constructor(props) {
super(props);
this.state = {
@@ -51,7 +51,7 @@ class IntervalInput extends PureComponent {
if (value >= 1 && value < 1000) {
this.setState({
valid: true
- }, this.props.changeInterval(value));
+ }, this.props.changeDelta(value));
} else {
this.setState({
valid: false
@@ -64,13 +64,17 @@ class IntervalInput extends PureComponent {
});
}
componentDidMount() {
- this.setValue(this.props.intervalValue);
+ this.setValue(this.props.deltaValue);
}
render() {
+ let {
+ value,
+ valid
+ } = this.state;
return (
- <input className="interval-input" type="text"
- style={this.state.valid ? {} : { borderColor: '#ff0000' }}
- min="1" step="1" value={this.state.value}
+ <input className="custom-interval-delta-input" type="text"
+ style={valid ? {} : { borderColor: '#ff0000' }}
+ min="1" step="1" value={value}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
onKeyDown={this.handleKeyPress}
@@ -79,9 +83,9 @@ class IntervalInput extends PureComponent {
}
}
-IntervalInput.propTypes = {
- intervalValue: PropTypes.number,
- changeInterval: PropTypes.func
+DeltaInput.propTypes = {
+ deltaValue: PropTypes.number,
+ changeDelta: PropTypes.func
};
-export default IntervalInput;
+export default DeltaInput;
diff --git a/web/js/components/timeline/interval-selector/timescale-select.js b/web/js/components/timeline/custom-interval-selector/interval-select.js
similarity index 62%
rename from web/js/components/timeline/interval-selector/timescale-select.js
rename to web/js/components/timeline/custom-interval-selector/interval-select.js
index 757341a1b..72188bbca 100644
--- a/web/js/components/timeline/interval-selector/timescale-select.js
+++ b/web/js/components/timeline/custom-interval-selector/interval-select.js
@@ -24,21 +24,21 @@ class TimeScaleSelect extends PureComponent {
} = this.props;
return (
<form
- className="interval-timescale-select-form-container"
+ className="custom-interval-timescale-select-form-container"
onSubmit={this.handleSubmit}
>
<select
- className="interval-timescale-select"
+ className="custom-interval-timescale-select"
value={zoomLevel}
onChange={this.handleChangeZoomLevel}
>
- <option className="interval-timescale-select-option" value="year">year</option>
- <option className="interval-timescale-select-option" value="month">month</option>
- <option className="interval-timescale-select-option" value="day">day</option>
+ <option className="custom-interval-timescale-select-option" value="year">year</option>
+ <option className="custom-interval-timescale-select-option" value="month">month</option>
+ <option className="custom-interval-timescale-select-option" value="day">day</option>
{hasSubdailyLayers
? <React.Fragment>
- <option className="interval-timescale-select-option" value="hour">hour</option>
- <option className="interval-timescale-select-option" value="minute">minute</option>
+ <option className="custom-interval-timescale-select-option" value="hour">hour</option>
+ <option className="custom-interval-timescale-select-option" value="minute">minute</option>
</React.Fragment>
: null
}
diff --git a/web/js/components/timeline/interval-selector/interval-selector.js b/web/js/components/timeline/custom-interval-selector/interval-selector-widget.js
similarity index 79%
rename from web/js/components/timeline/interval-selector/interval-selector.js
rename to web/js/components/timeline/custom-interval-selector/interval-selector-widget.js
index 206314332..aa5e63d83 100644
--- a/web/js/components/timeline/interval-selector/interval-selector.js
+++ b/web/js/components/timeline/custom-interval-selector/interval-selector-widget.js
@@ -1,9 +1,11 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
-import IntervalInput from './interval-input';
-import TimeScaleSelect from './timescale-select';
-
-import { timeScaleFromNumberKey, timeScaleToNumberKey } from '../../../modules/date/constants';
+import DeltaInput from './delta-input';
+import TimeScaleSelect from './interval-select';
+import {
+ timeScaleFromNumberKey,
+ timeScaleToNumberKey
+} from '../../../modules/date/constants';
/*
* CustomIntervalSelectorWidget for Custom Interval Selector
@@ -12,7 +14,7 @@ import { timeScaleFromNumberKey, timeScaleToNumberKey } from '../../../modules/d
* @class CustomIntervalSelectorWidget
*/
class CustomIntervalSelectorWidget extends PureComponent {
- changeInterval = (value) => {
+ changeDelta = (value) => {
if (value >= 0 && value <= 1000) {
this.props.changeCustomInterval(value, this.props.customIntervalZoomLevel);
}
@@ -49,16 +51,16 @@ class CustomIntervalSelectorWidget extends PureComponent {
return (
<div
onKeyDown={this.handleKeyPress}
- className='wv-custom-interval-widget'
+ className="custom-interval-widget"
style={{ display: customIntervalModalOpen ? 'block' : 'none' }}
tabIndex={0}
ref={(customIntervalWidget) => { this.customIntervalWidget = customIntervalWidget; }}
>
- <h3 className="wv-custom-interval-widget-header">Custom Interval Selector</h3>
- <div className="wv-custom-interval-widget-controls-container">
- <IntervalInput
- intervalValue={customDelta}
- changeInterval={this.changeInterval}
+ <h3 className="custom-interval-widget-header">Custom Interval Selector</h3>
+ <div className="custom-interval-widget-controls-container">
+ <DeltaInput
+ deltaValue={customDelta}
+ changeDelta={this.changeDelta}
/>
<TimeScaleSelect
hasSubdailyLayers={hasSubdailyLayers}
diff --git a/web/js/components/timeline/mobile-date-picker.js b/web/js/components/timeline/mobile-date-picker.js
index 2f3899f2f..271856317 100644
--- a/web/js/components/timeline/mobile-date-picker.js
+++ b/web/js/components/timeline/mobile-date-picker.js
@@ -87,10 +87,15 @@ class MobileDatePicker extends Component {
// used for init mount
setInitDates = () => {
+ let {
+ date,
+ startDateLimit,
+ endDateLimit
+ } = this.props;
this.setState({
- time: this.convertToUTCDateObject(this.props.date),
- minDate: this.convertToUTCDateObject(this.props.startDateLimit),
- maxDate: this.convertToUTCDateObject(this.props.endDateLimit)
+ time: this.convertToUTCDateObject(date),
+ minDate: this.convertToUTCDateObject(startDateLimit),
+ maxDate: this.convertToUTCDateObject(endDateLimit)
});
}
diff --git a/web/js/components/timeline/timeline-axis/date-calc.js b/web/js/components/timeline/timeline-axis/date-calc.js
index a2d98abec..7eefbd464 100644
--- a/web/js/components/timeline/timeline-axis/date-calc.js
+++ b/web/js/components/timeline/timeline-axis/date-calc.js
@@ -36,6 +36,7 @@ export function getTimeRange(startDate, endDate, timeScale, startDateLimit, endD
endLimit = limitCache[endDateLimit];
}
+ // build date/time array based on given start/end range
while (startDate <= endDate) {
let date = startDate.format(format);
let rawDate = getISODateFormatted(startDate);
diff --git a/web/js/components/timeline/timeline-axis/hover-line.js b/web/js/components/timeline/timeline-axis/date-tooltip/axis-hover-line.js
similarity index 53%
rename from web/js/components/timeline/timeline-axis/hover-line.js
rename to web/js/components/timeline/timeline-axis/date-tooltip/axis-hover-line.js
index b676df993..513af1363 100644
--- a/web/js/components/timeline/timeline-axis/hover-line.js
+++ b/web/js/components/timeline/timeline-axis/date-tooltip/axis-hover-line.js
@@ -2,15 +2,15 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
/*
- * HoverLine for axis hover
+ * AxisHoverLine for axis hover
*
- * @class HoverLine
+ * @class AxisHoverLine
* @extends PureComponent
*/
-class HoverLine extends PureComponent {
+class AxisHoverLine extends PureComponent {
render() {
let {
- width,
+ axisWidth,
isTimelineDragging,
isAnimationDraggerDragging,
showHoverLine,
@@ -20,9 +20,9 @@ class HoverLine extends PureComponent {
let showHover = !isTimelineDragging && !isAnimationDraggerDragging && showHoverLine;
return (
showHover
- ? <svg className='timeline-hover-line-container' width={width} height={63}>
- <line className='timeline-hover-line'
- stroke='blue' strokeWidth='2' strokeOpacity='0.48' x1='0' x2='0' y1='0' y2='63'
+ ? <svg className="axis-hover-line-container" width={axisWidth} height={63}>
+ <line className="axis-hover-line"
+ stroke="blue" strokeWidth="2" strokeOpacity="0.48" x1="0" x2="0" y1="0" y2="63"
transform={`translate(${hoverLinePosition + 1}, 0)`}
/>
</svg>
@@ -31,10 +31,12 @@ class HoverLine extends PureComponent {
}
}
-HoverLine.propTypes = {
+AxisHoverLine.propTypes = {
+ axisWidth: PropTypes.number,
+ hoverLinePosition: PropTypes.number,
isTimelineDragging: PropTypes.bool,
- showHoverLine: PropTypes.bool,
- hoverLinePosition: PropTypes.number
+ isAnimationDraggerDragging: PropTypes.bool,
+ showHoverLine: PropTypes.bool
};
-export default HoverLine;
+export default AxisHoverLine;
diff --git a/web/js/components/timeline/timeline-axis/date-tooltips.js b/web/js/components/timeline/timeline-axis/date-tooltip/date-tooltip.js
similarity index 93%
rename from web/js/components/timeline/timeline-axis/date-tooltips.js
rename to web/js/components/timeline/timeline-axis/date-tooltip/date-tooltip.js
index 26d082343..ef1fc79dd 100644
--- a/web/js/components/timeline/timeline-axis/date-tooltips.js
+++ b/web/js/components/timeline/timeline-axis/date-tooltip/date-tooltip.js
@@ -1,6 +1,6 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
-import { getDaysInYear } from '../date-util';
+import { getDaysInYear } from '../../date-util';
/*
* Date tooltip for hover and draggers
@@ -58,7 +58,7 @@ class DateToolTip extends PureComponent {
{
(showDraggerToolTip) || (showHoverToolTip)
? <div
- className='date-tooltip'
+ className="date-tooltip"
style={{
transform: `translate(${toolTipLeftOffest}px, -100px)`,
display: toolTipDisplay,
@@ -75,18 +75,17 @@ class DateToolTip extends PureComponent {
}
DateToolTip.propTypes = {
- draggerSelected: PropTypes.string,
+ axisWidth: PropTypes.number,
+ leftOffset: PropTypes.number,
+ hoverTime: PropTypes.string,
draggerPosition: PropTypes.number,
draggerPositionB: PropTypes.number,
- hasSubdailyLayers: PropTypes.bool,
- leftOffset: PropTypes.number,
- showDraggerTime: PropTypes.bool,
+ draggerSelected: PropTypes.string,
draggerTimeState: PropTypes.string,
draggerTimeStateB: PropTypes.string,
- hoverTime: PropTypes.string,
- isTimelineDragging: PropTypes.bool,
- showHoverLine: PropTypes.bool,
- axisWidth: PropTypes.number
+ hasSubdailyLayers: PropTypes.bool,
+ showDraggerTime: PropTypes.bool,
+ showHoverLine: PropTypes.bool
};
export default DateToolTip;
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index 1fdd92642..add525999 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -416,13 +416,13 @@ class TimelineAxis extends Component {
* @param {Boolean} draggerVisible
* @param {Number} newDraggerPosition
* @param {Object} sharedDraggerVisibilityParams
- * @param {Object} sharedDraggerVisibilityParams.frontDate
- * @param {String} sharedDraggerVisibilityParams.backDate
- * @param {Number} sharedDraggerVisibilityParams.position
- * @param {Number} sharedDraggerVisibilityParams.transform
+ * @param {Object} sharedDraggerVisibilityParams.frontDate
+ * @param {String} sharedDraggerVisibilityParams.backDate
+ * @param {Number} sharedDraggerVisibilityParams.position
+ * @param {Number} sharedDraggerVisibilityParams.transform
* @returns {Object} output - return params used for dragger visibilty/updating dragger position
- * @returns {Boolean} output.newDraggerPosition
- * @returns {Boolean} output.isVisible - dragger within visible range
+ * @returns {Boolean} output.newDraggerPosition
+ * @returns {Boolean} output.isVisible - dragger within visible range
*/
checkDraggerVisibility = (draggerTime, draggerVisible, newDraggerPosition, { frontDate, backDate, position, transform }) => {
let { gridWidth } = this.state;
@@ -1170,47 +1170,47 @@ class TimelineAxis extends Component {
axisWidth,
timeScale,
position,
- transformX
+ transformX,
+ showHover,
+ showHoverOff
} = this.props;
-
let {
currentTimeRange,
gridWidth,
leftBound,
rightBound
} = this.state;
-
return (
<React.Fragment>
- <div className='timeline-axis-container'
+ <div className="timeline-axis-container"
style={{ width: `${axisWidth}px` }}
onMouseDown={this.handleMouseDown}
onMouseUp={this.setLineTime}
onWheel={this.handleWheel}
onMouseOver={this.showHoverOn}
- onMouseLeave={this.props.showHoverOff}
+ onMouseLeave={showHoverOff}
onTouchStart={this.handleMouseDown}
onTouchEnd={this.setLineTimeTouch}
>
{currentTimeRange
- ? <svg className='timeline-axis-svg'
- id='timeline-footer-svg'
+ ? <svg className="timeline-axis-svg"
+ id="timeline-footer-svg"
width={axisWidth}
height={64}
viewBox={`0 0 ${axisWidth} 64`}
- preserveAspectRatio='xMinYMin slice'>
+ preserveAspectRatio="xMinYMin slice">
<defs>
{/* clip axis grid text */}
- <clipPath id='textDisplay'>
- <rect width='200' height='64' />
+ <clipPath id="textDisplay">
+ <rect width="200" height="64" />
</clipPath>
{/* clip axis grid overflow */}
- <clipPath id='timelineBoundary'>
+ <clipPath id="timelineBoundary">
<rect width={axisWidth} height={64}></rect>
</clipPath>
</defs>
<Draggable
- axis='x'
+ axis="x"
handle=".axis-grid-container"
position={{ x: position, y: 0 }}
onDrag={this.handleDrag}
@@ -1220,7 +1220,7 @@ class TimelineAxis extends Component {
>
<g>
<GridRange
- showHover={this.props.showHover}
+ showHover={showHover}
timeScale={timeScale}
gridWidth={gridWidth}
timeRange={currentTimeRange}
@@ -1237,11 +1237,21 @@ class TimelineAxis extends Component {
}
TimelineAxis.propTypes = {
+ axisWidth: PropTypes.number,
+ position: PropTypes.number,
+ transformX: PropTypes.number,
+ hoverTime: PropTypes.string,
+ frontDate: PropTypes.string,
+ backDate: PropTypes.string,
+ timeScale: PropTypes.string,
dateA: PropTypes.string,
dateB: PropTypes.string,
animEndLocationDate: PropTypes.object,
animStartLocationDate: PropTypes.object,
- axisWidth: PropTypes.number,
+ animationStartLocation: PropTypes.number,
+ animationEndLocation: PropTypes.number,
+ timelineEndDateLimit: PropTypes.string,
+ timelineStartDateLimit: PropTypes.string,
changeTimeScale: PropTypes.func,
updateDraggerDatePosition: PropTypes.func,
showHover: PropTypes.func,
@@ -1251,34 +1261,23 @@ TimelineAxis.propTypes = {
updatePositioningOnSimpleDrag: PropTypes.func,
updatePositioningOnAxisStopDrag: PropTypes.func,
updateTimelineMoveAndDrag: PropTypes.func,
- isCompareModeActive: PropTypes.bool,
draggerSelected: PropTypes.string,
- hasSubdailyLayers: PropTypes.bool,
parentOffset: PropTypes.number,
leftOffset: PropTypes.number,
draggerPosition: PropTypes.number,
draggerPositionB: PropTypes.number,
- draggerVisible: PropTypes.bool,
- draggerVisibleB: PropTypes.bool,
- animationStartLocation: PropTypes.number,
- animationEndLocation: PropTypes.number,
- position: PropTypes.number,
- transformX: PropTypes.number,
- hoverTime: PropTypes.string,
draggerTimeState: PropTypes.string,
draggerTimeStateB: PropTypes.string,
- frontDate: PropTypes.string,
- backDate: PropTypes.string,
- startDate: PropTypes.string,
- timeScale: PropTypes.string,
- timelineEndDateLimit: PropTypes.string,
- timelineStartDateLimit: PropTypes.string,
+ draggerVisible: PropTypes.bool,
+ draggerVisibleB: PropTypes.bool,
+ hasSubdailyLayers: PropTypes.bool,
+ isCompareModeActive: PropTypes.bool,
isDraggerDragging: PropTypes.bool,
isAnimationDraggerDragging: PropTypes.bool,
isTimelineDragging: PropTypes.bool,
- hasMoved: PropTypes.bool,
isTourActive: PropTypes.bool,
- isAnimationPlaying: PropTypes.bool
+ isAnimationPlaying: PropTypes.bool,
+ hasMoved: PropTypes.bool
};
export default TimelineAxis;
diff --git a/web/js/components/timeline/timeline-controls/animation-button.js b/web/js/components/timeline/timeline-controls/animation-button.js
index 7e51db701..e7802c4b8 100644
--- a/web/js/components/timeline/timeline-controls/animation-button.js
+++ b/web/js/components/timeline/timeline-controls/animation-button.js
@@ -20,6 +20,7 @@ class AnimationButton extends PureComponent {
}
AnimationButton.propTypes = {
+ disabled: PropTypes.bool,
clickAnimationButton: PropTypes.func
};
diff --git a/web/js/components/timeline/timeline-controls/axis-timescale-change-tooltip.js b/web/js/components/timeline/timeline-controls/axis-timescale-change-tooltip.js
index 15a4236d8..b5f563763 100644
--- a/web/js/components/timeline/timeline-controls/axis-timescale-change-tooltip.js
+++ b/web/js/components/timeline/timeline-controls/axis-timescale-change-tooltip.js
@@ -106,7 +106,8 @@ class AxisTimeScaleChangeTooltip extends PureComponent {
AxisTimeScaleChangeTooltip.propTypes = {
timeScale: PropTypes.string,
changeTimeScale: PropTypes.func,
- hasSubdailyLayers: PropTypes.bool
+ hasSubdailyLayers: PropTypes.bool,
+ toolTipHovered: PropTypes.bool
};
export default AxisTimeScaleChangeTooltip;
diff --git a/web/js/components/timeline/timeline-controls/interval-timescale-change.js b/web/js/components/timeline/timeline-controls/interval-timescale-change.js
index 6fbab1e25..4bf1487a1 100644
--- a/web/js/components/timeline/timeline-controls/interval-timescale-change.js
+++ b/web/js/components/timeline/timeline-controls/interval-timescale-change.js
@@ -179,12 +179,11 @@ class TimeScaleIntervalChange extends PureComponent {
}
TimeScaleIntervalChange.propTypes = {
+ timeScaleChangeUnit: PropTypes.string,
customDelta: PropTypes.number,
- customIntervalText: PropTypes.string,
- customSelected: PropTypes.bool,
- setTimeScaleIntervalChangeUnit: PropTypes.func,
customIntervalZoomLevel: PropTypes.string,
- timeScaleChangeUnit: PropTypes.string
+ customSelected: PropTypes.bool,
+ setTimeScaleIntervalChangeUnit: PropTypes.func
};
export default TimeScaleIntervalChange;
diff --git a/web/js/components/timeline/timeline-axis/dragger-container.js b/web/js/components/timeline/timeline-draggers/dragger-container.js
similarity index 91%
rename from web/js/components/timeline/timeline-axis/dragger-container.js
rename to web/js/components/timeline/timeline-draggers/dragger-container.js
index 0ba088b6b..91f9f6aaa 100644
--- a/web/js/components/timeline/timeline-axis/dragger-container.js
+++ b/web/js/components/timeline/timeline-draggers/dragger-container.js
@@ -237,7 +237,7 @@ class DraggerContainer extends PureComponent {
let {
draggerSelected,
toggleShowDraggerTime,
- width,
+ axisWidth,
transformX,
isCompareModeActive,
draggerPosition,
@@ -255,7 +255,7 @@ class DraggerContainer extends PureComponent {
};
return (
draggerSelected === 'selectedB'
- ? <svg className="dragger-container" width={width} height={83}>
+ ? <svg className="dragger-container" width={axisWidth} height={83}>
{isCompareModeActive
? <Dragger
{...sharedProps}
@@ -273,7 +273,7 @@ class DraggerContainer extends PureComponent {
draggerVisible={draggerVisibleB}
/>
</svg>
- : <svg className="dragger-container" width={width} height={83}>
+ : <svg className="dragger-container" width={axisWidth} height={83}>
{isCompareModeActive
? <Dragger
{...sharedProps}
@@ -296,15 +296,27 @@ class DraggerContainer extends PureComponent {
}
DraggerContainer.propTypes = {
- isCompareModeActive: PropTypes.bool,
- disabled: PropTypes.bool,
- draggerName: PropTypes.string,
+ axisWidth: PropTypes.number,
+ position: PropTypes.number,
+ transformX: PropTypes.number,
+ timeScale: PropTypes.string,
+ timelineStartDateLimit: PropTypes.string,
+ timelineEndDateLimit: PropTypes.string,
+ frontDate: PropTypes.string,
+ backDate: PropTypes.string,
draggerPosition: PropTypes.number,
+ draggerPositionB: PropTypes.number,
+ draggerSelected: PropTypes.string,
+ draggerTimeState: PropTypes.string,
+ draggerTimeStateB: PropTypes.string,
draggerVisible: PropTypes.bool,
- handleDragDragger: PropTypes.func,
- selectDragger: PropTypes.func,
+ draggerVisibleB: PropTypes.bool,
+ isCompareModeActive: PropTypes.bool,
+ isDraggerDragging: PropTypes.bool,
+ onChangeSelectedDragger: PropTypes.func,
+ setDraggerVisibility: PropTypes.func,
toggleShowDraggerTime: PropTypes.func,
- transformX: PropTypes.number
+ updateDraggerDatePosition: PropTypes.func
};
export default DraggerContainer;
diff --git a/web/js/components/timeline/timeline-axis/timeline-dragger.js b/web/js/components/timeline/timeline-draggers/timeline-dragger.js
similarity index 100%
rename from web/js/components/timeline/timeline-axis/timeline-dragger.js
rename to web/js/components/timeline/timeline-draggers/timeline-dragger.js
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 277dd95e5..fc648b569 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -9,10 +9,10 @@ import MobileDatePicker from '../../components/timeline/mobile-date-picker';
import TimelineAxis from '../../components/timeline/timeline-axis/timeline-axis';
import TimeScaleIntervalChange from '../../components/timeline/timeline-controls/interval-timescale-change';
-import DraggerContainer from '../../components/timeline/timeline-axis/dragger-container';
-import HoverLine from '../../components/timeline/timeline-axis/hover-line';
-import DateToolTip from '../../components/timeline/timeline-axis/date-tooltips';
-import CustomIntervalSelectorWidget from '../../components/timeline/interval-selector/interval-selector';
+import DraggerContainer from '../../components/timeline/timeline-draggers/dragger-container';
+import AxisHoverLine from '../../components/timeline/timeline-axis/date-tooltip/axis-hover-line';
+import DateToolTip from '../../components/timeline/timeline-axis/date-tooltip/date-tooltip';
+import CustomIntervalSelectorWidget from '../../components/timeline/custom-interval-selector/interval-selector-widget';
import DateSelector from '../../components/date-selector/date-selector';
import DateChangeArrows from '../../components/timeline/timeline-controls/date-change-arrows';
@@ -61,11 +61,9 @@ class Timeline extends React.Component {
constructor(props) {
super(props);
this.state = {
- initialLoadComplete: false,
- timelineHidden: false,
- customIntervalModalOpen: false,
position: 0,
transformX: 0,
+ leftOffset: 0,
frontDate: '',
backDate: '',
animationStartLocationDate: '',
@@ -78,15 +76,17 @@ class Timeline extends React.Component {
draggerPositionB: 0,
draggerVisible: true,
draggerVisibleB: false,
- hasMoved: false,
hoverTime: '',
hoverLinePosition: 0,
showHoverLine: false,
showDraggerTime: false,
isDraggerDragging: false,
- leftOffset: 0,
isAnimationDraggerDragging: false,
isTimelineDragging: false,
+ initialLoadComplete: false,
+ timelineHidden: false,
+ hasMoved: false,
+ customIntervalModalOpen: false,
rangeSelectorMax: { end: false, start: false, startOffset: -50, width: 50000 }
};
// left/right arrows
@@ -208,18 +208,19 @@ class Timeline extends React.Component {
/**
* @desc handles dynamic position changes from axis that affect dragger and range select
* @param {Object} args
- * @param {Boolean} hasMoved
- * @param {Boolean} isTimelineDragging
- * @param {Number} position
- * @param {Number} transformX
- * @param {String} frontDate
- * @param {String} backDate
- * @param {Number} draggerPosition
- * @param {Number} draggerPositionB
- * @param {Boolean} draggerVisible
- * @param {Boolean} draggerVisibleB
- * @param {Number} animationStartLocation
- * @param {Number} animationEndLocation
+ * @param {Boolean} hasMoved
+ * @param {Boolean} isTimelineDragging
+ * @param {Number} position
+ * @param {Number} transformX
+ * @param {String} frontDate
+ * @param {String} backDate
+ * @param {Number} draggerPosition
+ * @param {Number} draggerPositionB
+ * @param {Boolean} draggerVisible
+ * @param {Boolean} draggerVisibleB
+ * @param {Number} animationStartLocation
+ * @param {Number} animationEndLocation
+ * @param {String} hoverTime - defaults to state
* @returns {void}
*/
updatePositioning = ({
@@ -257,13 +258,13 @@ class Timeline extends React.Component {
/**
* @desc handles dynamic positioning update based on simple drag
* @param {Object} args
- * @param {Boolean} hasMoved
- * @param {Boolean} isTimelineDragging
- * @param {Number} position
- * @param {Number} draggerPosition
- * @param {Number} draggerPositionB
- * @param {Number} animationStartLocation
- * @param {Number} animationEndLocation
+ * @param {Boolean} hasMoved
+ * @param {Boolean} isTimelineDragging
+ * @param {Number} position
+ * @param {Number} draggerPosition
+ * @param {Number} draggerPositionB
+ * @param {Number} animationStartLocation
+ * @param {Number} animationEndLocation
* @returns {void}
*/
updatePositioningOnSimpleDrag = ({
@@ -290,10 +291,11 @@ class Timeline extends React.Component {
/**
* @desc handles dynamic positioning update based on axis drag stop event
* @param {Object} args
- * @param {Boolean} hasMoved
- * @param {Boolean} isTimelineDragging
- * @param {Number} position
- * @param {Number} transformX
+ * @param {Boolean} hasMoved
+ * @param {Boolean} isTimelineDragging
+ * @param {Number} position
+ * @param {Number} transformX
+ * @param {String} hoverTime - defaults to state
* @returns {void}
*/
updatePositioningOnAxisStopDrag = ({
@@ -813,8 +815,8 @@ class Timeline extends React.Component {
date={selectedDate}
startDateLimit={timelineStartDateLimit}
endDateLimit={timelineEndDateLimit}
- hasSubdailyLayers={hasSubdailyLayers}
onDateChange={this.onDateChange}
+ hasSubdailyLayers={hasSubdailyLayers}
/>
: <section id="timeline" className="timeline-inner clearfix">
<div id="timeline-header"
@@ -822,12 +824,12 @@ class Timeline extends React.Component {
>
<div id="date-selector-main">
<DateSelector
- onDateChange={this.onDateChange}
date={new Date(selectedDate)}
- hasSubdailyLayers={hasSubdailyLayers}
draggerSelected={draggerSelected}
+ onDateChange={this.onDateChange}
maxDate={new Date(timelineEndDateLimit)}
minDate={new Date(timelineStartDateLimit)}
+ hasSubdailyLayers={hasSubdailyLayers}
fontSize={24}
/>
</div>
@@ -849,8 +851,8 @@ class Timeline extends React.Component {
/>
</div>
<AnimationButton
- disabled={animationDisabled}
clickAnimationButton={this.clickAnimationButton}
+ disabled={animationDisabled}
/>
</div>
@@ -862,56 +864,55 @@ class Timeline extends React.Component {
>
{/* Axis */}
<TimelineAxis
- isAnimationPlaying={isAnimationPlaying}
- isTourActive={isTourActive}
- frontDate={frontDate}
- backDate={backDate}
- isTimelineDragging={isTimelineDragging}
- hasMoved={hasMoved}
axisWidth={axisWidth}
- hasSubdailyLayers={hasSubdailyLayers}
- changeTimeScale={this.changeTimeScale}
- isCompareModeActive={isCompareModeActive}
- draggerSelected={draggerSelected}
- onChangeSelectedDragger={toggleActiveCompareState}
+ parentOffset={parentOffset}
+ leftOffset={leftOffset}
+ position={position}
+ transformX={transformX}
+ timeScale={timeScale}
timelineStartDateLimit={timelineStartDateLimit}
timelineEndDateLimit={timelineEndDateLimit}
- animStartLocationDate={animStartLocationDate}
- animEndLocationDate={animEndLocationDate}
- isAnimationDraggerDragging={isAnimationDraggerDragging}
- updateDraggerDatePosition={this.updateDraggerDatePosition}
+ frontDate={frontDate}
+ backDate={backDate}
dateA={dateA}
dateB={dateB}
+ hoverTime={hoverTime}
+ draggerSelected={draggerSelected}
draggerTimeState={draggerTimeState}
draggerTimeStateB={draggerTimeStateB}
draggerPosition={draggerPosition}
draggerPositionB={draggerPositionB}
draggerVisible={draggerVisible}
draggerVisibleB={draggerVisibleB}
- transformX={transformX}
+ animationStartLocation={animationStartLocation}
+ animationEndLocation={animationEndLocation}
+ animStartLocationDate={animStartLocationDate}
+ animEndLocationDate={animEndLocationDate}
+ changeTimeScale={this.changeTimeScale}
updatePositioning={this.updatePositioning}
updateTimelineMoveAndDrag={this.updateTimelineMoveAndDrag}
updatePositioningOnSimpleDrag={this.updatePositioningOnSimpleDrag}
updatePositioningOnAxisStopDrag={this.updatePositioningOnAxisStopDrag}
- position={position}
- animationStartLocation={animationStartLocation}
- animationEndLocation={animationEndLocation}
- timeScale={timeScale}
+ updateDraggerDatePosition={this.updateDraggerDatePosition}
showHoverOn={this.showHoverOn}
showHoverOff={this.showHoverOff}
showHover={this.showHover}
- leftOffset={leftOffset}
- hoverTime={hoverTime}
+ hasSubdailyLayers={hasSubdailyLayers}
+ isCompareModeActive={isCompareModeActive}
+ isAnimationPlaying={isAnimationPlaying}
+ isTourActive={isTourActive}
+ isAnimationDraggerDragging={isAnimationDraggerDragging}
isDraggerDragging={isDraggerDragging}
- parentOffset={parentOffset}
+ isTimelineDragging={isTimelineDragging}
+ hasMoved={hasMoved}
/>
- <HoverLine
- width={axisWidth}
+ <AxisHoverLine
+ axisWidth={axisWidth}
+ hoverLinePosition={hoverLinePosition}
+ showHoverLine={showHoverLine}
isTimelineDragging={isTimelineDragging}
isAnimationDraggerDragging={isAnimationDraggerDragging}
- showHoverLine={showHoverLine}
- hoverLinePosition={hoverLinePosition}
/>
{isAnimationWidgetOpen &&
@@ -921,22 +922,20 @@ class Timeline extends React.Component {
this.state.animationEndLocation &&
this.state.animationEndLocationDate
? <TimelineRangeSelector
+ axisWidth={axisWidth}
position={position}
- frontDate={frontDate}
- isAnimationDraggerDragging={isAnimationDraggerDragging}
+ transformX={transformX}
timeScale={timeScale}
+ timelineStartDateLimit={timelineStartDateLimit}
+ timelineEndDateLimit={timelineEndDateLimit}
+ frontDate={frontDate}
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'}
@@ -948,43 +947,43 @@ class Timeline extends React.Component {
{frontDate
? <DraggerContainer
+ axisWidth={axisWidth}
position={position}
+ transformX={transformX}
+ timeScale={timeScale}
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}
- isCompareModeActive={isCompareModeActive}
draggerTimeState={draggerTimeState}
draggerTimeStateB={draggerTimeStateB}
draggerPosition={draggerPosition}
draggerPositionB={draggerPositionB}
draggerVisible={draggerVisible}
draggerVisibleB={draggerVisibleB}
+ setDraggerVisibility={this.setDraggerVisibility}
+ toggleShowDraggerTime={this.toggleShowDraggerTime}
+ onChangeSelectedDragger={toggleActiveCompareState}
+ updateDraggerDatePosition={this.updateDraggerDatePosition}
+ isCompareModeActive={isCompareModeActive}
isDraggerDragging={isDraggerDragging}
/>
: null }
{!isTimelineDragging
? <DateToolTip
+ axisWidth={axisWidth}
+ leftOffset={leftOffset}
+ hoverTime={hoverTime}
draggerSelected={draggerSelected}
+ draggerTimeState={draggerTimeState}
+ draggerTimeStateB={draggerTimeStateB}
draggerPosition={draggerPosition}
draggerPositionB={draggerPositionB}
hasSubdailyLayers={hasSubdailyLayers}
- leftOffset={leftOffset}
showDraggerTime={showDraggerTime}
- draggerTimeState={draggerTimeState}
- draggerTimeStateB={draggerTimeStateB}
- hoverTime={hoverTime}
showHoverLine={showHoverLine}
- axisWidth={axisWidth}
/>
: null
}
@@ -1002,11 +1001,11 @@ class Timeline extends React.Component {
{/* Zoom Level Change */}
<AxisTimeScaleChange
- isDraggerDragging={isDraggerDragging}
- timelineHidden={timelineHidden}
timeScale={timeScale}
changeTimeScale={this.changeTimeScale}
+ isDraggerDragging={isDraggerDragging}
hasSubdailyLayers={hasSubdailyLayers}
+ timelineHidden={timelineHidden}
/>
{/* Open/Close Chevron */}
@@ -1191,7 +1190,6 @@ export default connect(
Timeline.propTypes = {
screenWidth: PropTypes.number,
- screenHeight: PropTypes.number,
draggerSelected: PropTypes.string,
hasSubdailyLayers: PropTypes.bool,
customSelected: PropTypes.bool,