Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

remove key bug preventing touch tablet axis drag, WIP to handle touch click dragger date change, comment and renaming variables

Edward Plato620a64de94af
diff --git a/package-lock.json b/package-lock.json
index c4224f203..45fc13f41 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -24,11 +24,6 @@
"js-tokens": "^4.0.0"
}
},
- "@babel/preset-stage-0": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/@babel/preset-stage-0/-/preset-stage-0-7.0.0.tgz",
- "integrity": "sha512-FBMd0IiARPtH5aaOFUVki6evHiJQiY0pFy7fizyRF7dtwc+el3nwpzvhb9qBNzceG1OIJModG1xpE0DDFjPXwA=="
- },
"@babel/runtime": {
"version": "7.3.4",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.3.4.tgz",
diff --git a/web/js/components/timeline/timeline-axis/dragger-container.js b/web/js/components/timeline/timeline-axis/dragger-container.js
index 823dcac9a..4d46b5263 100644
--- a/web/js/components/timeline/timeline-axis/dragger-container.js
+++ b/web/js/components/timeline/timeline-axis/dragger-container.js
@@ -11,7 +11,7 @@ import { timeScaleOptions } from '../../../modules/date/constants';
* Dragger container used to conditionally render based on selected dragger
* this is necessary for svg dragger z-index (ex: allow B to drag over A if B being dragged)
*
- * @class Dragger
+ * @class DraggerContainer
* @extends PureComponent
*/
class DraggerContainer extends PureComponent {
@@ -22,7 +22,12 @@ class DraggerContainer extends PureComponent {
};
}
- // select dragger 'selected' or 'selectedB'
+ /**
+ * @desc select dragger 'selected' or 'selectedB'
+ * @param {String} draggerName
+ * @param {Event} click event
+ * @returns {void}
+ */
selectDragger = (draggerName, e) => {
if (e) {
e.stopPropagation();
@@ -33,7 +38,11 @@ class DraggerContainer extends PureComponent {
}
}
- // move draggerTimeState to inputTime
+ /**
+ * @desc move draggerTimeState to inputTime
+ * @param {String} inputTime
+ * @returns {void}
+ */
setDraggerPosition = (inputTime) => {
let frontDate = this.props.frontDate;
let backDate = this.props.backDate;
@@ -57,8 +66,13 @@ class DraggerContainer extends PureComponent {
this.props.updateDraggerDatePosition(null, draggerName, newDraggerPosition, draggerVisible);
}
- // handle dragger dragging
- handleDragDragger = (draggerName, e, d) => {
+ /**
+ * @desc handle dragger dragging
+ * @param {Event} mouse event
+ * @param {Object} draggable delta object
+ * @returns {void}
+ */
+ handleDragDragger = (e, d) => {
if (e) {
e.stopPropagation();
e.preventDefault();
@@ -77,7 +91,7 @@ class DraggerContainer extends PureComponent {
// let axisWidth = this.props.axisWidth;
// let dragSentinelChangeNumber = this.state.dragSentinelChangeNumber;
// let dragSentinelCount = this.state.dragSentinelCount;
-
+ let draggerName = this.props.draggerSelected;
let time;
let draggerPosition;
let draggerASelected = draggerName === 'selected';
@@ -213,17 +227,17 @@ class DraggerContainer extends PureComponent {
}
componentDidUpdate(prevProps, prevState) {
- let { draggerTimeState, draggerTimeStateB, timeScale } = this.props;
+ let { draggerTimeState, draggerTimeStateB } = this.props;
let { isDraggerDragging } = this.props;
let { dateA, dateB, draggerSelected, compareModeActive } = this.props;
// handle dragger visibility update on compare mode activate/deactivate
if (compareModeActive !== prevProps.compareModeActive) {
- // TURN ON COMPARE MODE
+ // turn on compare mode
if (compareModeActive) {
this.props.setDraggerVisibility(true, true);
} else {
- // TURN OFF COMPARE MODE
+ // turn off compare mode
if (draggerSelected === 'selected') {
this.props.setDraggerVisibility(true, false);
} else {
@@ -235,13 +249,11 @@ class DraggerContainer extends PureComponent {
if (!isDraggerDragging) {
// handle A dragger change
if (draggerTimeState !== prevProps.draggerTimeState) {
- // this.setDraggerPosition(prevProps.draggerTimeState, draggerTimeState)
- this.setDraggerPosition(draggerTimeState)
+ this.setDraggerPosition(draggerTimeState);
}
// handle B dragger change
if (draggerTimeStateB !== prevProps.draggerTimeStateB) {
- // this.setDraggerPosition(prevProps.draggerTimeStateB, draggerTimeStateB)
- this.setDraggerPosition(draggerTimeStateB)
+ this.setDraggerPosition(draggerTimeStateB);
}
}
}
diff --git a/web/js/components/timeline/timeline-axis/grid-range/grid-range.js b/web/js/components/timeline/timeline-axis/grid-range/grid-range.js
index 949ba095a..9b4be8dd9 100644
--- a/web/js/components/timeline/timeline-axis/grid-range/grid-range.js
+++ b/web/js/components/timeline/timeline-axis/grid-range/grid-range.js
@@ -3,7 +3,11 @@ import PropTypes from 'prop-types';
import TileRect from './tile-rect';
import TileText from './tile-text';
-// determine if text will be rendered via itemDateObject param used with timeScale key
+/**
+* @desc object key used for TileText
+* @param {String} timeScale
+* @returns {Function} used to determine if text will be rendered
+*/
const tileTextConditionOptions = {
minute: (itemDateObject) => {
let timeScaleUnit = itemDateObject.minutes;
@@ -49,7 +53,7 @@ class GridRange extends PureComponent {
{timeRange.map((item, index) => {
return (
item.withinRange
- ? <React.Fragment key={`${item.rawDate}${index}`}>
+ ? <React.Fragment key={index}>
<TileRect
item={item}
index={index}
diff --git a/web/js/components/timeline/timeline-axis/grid-range/tile-rect.js b/web/js/components/timeline/timeline-axis/grid-range/tile-rect.js
index 874c0eddc..e59ddfe5b 100644
--- a/web/js/components/timeline/timeline-axis/grid-range/tile-rect.js
+++ b/web/js/components/timeline/timeline-axis/grid-range/tile-rect.js
@@ -1,6 +1,11 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
+/**
+* @desc object key used for TileRect
+* @param {String} timeScale
+* @returns {Function} used to determine if lineLengthY
+*/
const tileRectTimeScaleOptions = {
minute: function() {
return {
@@ -62,11 +67,21 @@ class TileRect extends PureComponent {
this.showHover = this.showHover.bind(this);
}
+ /**
+ * @desc show hover used to display date and set hoverTime
+ * @param {Event} mouse event
+ * @returns {void}
+ */
showHover = (e) => {
let { item, index } = this.props;
this.props.showHover(e, item.rawDate, item.rawNextDate, index);
}
+ /**
+ * @desc show hover used to display date and set hoverTime
+ * @param {Event} touch event
+ * @returns {void}
+ */
showTouch = (e) => {
let { item, index } = this.props;
let touch = e.changedTouches[0];
@@ -75,7 +90,12 @@ class TileRect extends PureComponent {
}
render() {
- let { item, gridWidth, index, timeScale } = this.props;
+ let {
+ item,
+ gridWidth,
+ index,
+ timeScale
+ } = this.props;
let tileOptions = tileRectTimeScaleOptions[timeScale]();
let lineLengthY = tileOptions.lineLengthY(item);
let whiteLineStrokeWidth = lineLengthY !== 10 ? 2 : 1;
@@ -112,7 +132,6 @@ TileRect.propTypes = {
item: PropTypes.object,
index: PropTypes.number,
gridWidth: PropTypes.number,
- draggerPosition: PropTypes.func,
timeScale: PropTypes.string
};
diff --git a/web/js/components/timeline/timeline-axis/grid-range/tile-text.js b/web/js/components/timeline/timeline-axis/grid-range/tile-text.js
index 8705ea33a..0db64085d 100644
--- a/web/js/components/timeline/timeline-axis/grid-range/tile-text.js
+++ b/web/js/components/timeline/timeline-axis/grid-range/tile-text.js
@@ -1,6 +1,12 @@
import React from 'react';
-// Wrapper for TileText to determine what time unit to display
+/**
+* @desc Wrapper for TileText to determine what time unit to display
+* @param {Object} item
+* @param {Number} index
+* @param {Number} gridWidth
+* @returns {Object} svg text DOM object
+*/
const axisScaleTextElementWrapper = (item, index, gridWidth) => {
let dateText = item.date;
if (item.timeScale === 'hour') {
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index 2816e42b5..671ad421a 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Draggable from 'react-draggable';
import moment from 'moment';
+import util from '../../../util/util';
import GridRange from './grid-range/grid-range';
@@ -37,7 +38,16 @@ class TimelineAxis extends Component {
// axis click to set dragger
this.setLineTime = this.setLineTime.bind(this);
}
- // main function to update axis scale, time range, grids tiles/text, draggerA/B positions, animation start/end draggers
+
+ /**
+ * @desc main function to update axis scale, time range, grids tiles/text, draggerA/B positions, animation start/end draggers
+ * @param {String} inputDate
+ * @param {String} timeScale
+ * @param {Number} axisWidthInput
+ * @param {Number} leftOffsetFixedCoeff
+ * @param {Boolean} hoverChange
+ * @returns {void}
+ */
updateScale = (inputDate, timeScale, axisWidthInput, leftOffsetFixedCoeff, hoverChange) => {
console.log(inputDate, timeScale, axisWidthInput, leftOffsetFixedCoeff, hoverChange)
let maxDateTimelineEndDateLimit = this.props.timelineEndDateLimit;
@@ -202,9 +212,13 @@ class TimelineAxis extends Component {
}, this.props.updatePositioning(updatePositioningArguments));
}
- // return date array of days based on:
- // subtract - integer (negative numbers selects start date in the future)
- // add - integer (negative numbers selects end date in the past)
+ /**
+ * @desc update dates in range based on dragging axis
+ * @param {Number} subtract - integer (negative numbers selects start date in the future)
+ * @param {Number} add - integer (negative numbers selects end date in the past)
+ * @param {string} inputDate
+ * @returns {Array} timeRangeArray - time range
+ */
getTimeRangeArray = (subtract, add, inputDate) => {
let {
timelineEndDateLimit,
@@ -217,8 +231,6 @@ class TimelineAxis extends Component {
if (timeScale === 'year') {
dayZeroed = moment.utc(inputDate).startOf('year');
- // let endLimitYear = moment.utc(timelineEndDateLimit).year() + 1;
- // let startLimitYear = moment.utc(timelineStartDateLimit).year();
let endLimitYear = new Date(timelineEndDateLimit).getUTCFullYear() + 1;
let startLimitYear = new Date(timelineStartDateLimit).getUTCFullYear();
startDate = dayZeroed.year(startLimitYear);
@@ -245,7 +257,22 @@ class TimelineAxis extends Component {
return timeRangeArray;
}
- // update dates in range based on dragging axis
+ /**
+ * @desc update dates in range based on dragging axis
+ * @param {Number} position
+ * @param {Number} deltaX
+ * @param {Number} draggerPosition
+ * @param {Number} draggerPositionB
+ * @param {Number} overDrag
+ * @returns {Object} output - return new time range and dragger visibilty/updated position
+ * @returns {Array} output.currentTimeRange
+ * @returns {Number} output.transformX
+ * @returns {Boolean} output.draggerVisible
+ * @returns {Boolean} output.draggerVisibleB
+ * @returns {Number} output.overDragGrids
+ * @returns {Number} output.newDraggerPosition
+ * @returns {Number} output.newDraggerPositionB
+ */
updateTimeRangeFromDrag = (position, deltaX, draggerPosition, draggerPositionB, overDrag) => {
let {
gridWidth,
@@ -262,7 +289,7 @@ class TimelineAxis extends Component {
compareModeActive,
draggerSelected
} = this.props;
-
+ console.log(position, deltaX, draggerPosition, draggerPositionB, overDrag)
numberOfVisibleTiles = Math.floor(numberOfVisibleTiles * 0.25);
let overDragGrids = Math.ceil(overDrag / gridWidth);
let timeRangeAdd;
@@ -273,6 +300,8 @@ class TimelineAxis extends Component {
removeBackMultipleInPlace(currentTimeRange, numberOfVisibleTiles + 1 + overDragGrids);
currentTimeRange.unshift(...timeRangeAdd);
transform = transformX - (numberOfVisibleTiles + 1 + overDragGrids) * gridWidth;
+
+ console.log(timeRangeAdd, transform)
} else { // dragging left - exposing future dates
let lastDateInRange = currentTimeRange[currentTimeRange.length - 1].rawDate;
timeRangeAdd = this.getTimeRangeArray(-1, numberOfVisibleTiles + 1 + overDragGrids, lastDateInRange);
@@ -330,7 +359,21 @@ class TimelineAxis extends Component {
};
}
- // check dragger visibility and return newDraggerPosition if dragger initially false and now visible
+ /**
+ * @desc helper function used in updateTimeRangeFromDrag
+ * @desc check dragger visibility and calculate newDraggerPosition if dragger initially false and now visible
+ * @param {String} draggerTime
+ * @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
+ * @returns {Object} output - return params used for dragger visibilty/updating dragger position
+ * @returns {Boolean} output.newDraggerPosition
+ * @returns {Boolean} output.isVisible - dragger within visible range
+ */
checkDraggerVisibility = (draggerTime, draggerVisible, newDraggerPosition, { frontDate, backDate, position, transform }) => {
let { gridWidth } = this.state;
let { timeScale } = this.props;
@@ -435,8 +478,7 @@ class TimelineAxis extends Component {
}
/**
- * check if selectedDate will be within acceptable visible axis width
- *
+ * @desc check if selectedDate will be within acceptable visible axis width
* @param {String} selectedDate
* @param {Boolean} draggerB - draggerB being checked?
* @returns {Object} output - return params used for dragger visibilty/updating axis
@@ -475,14 +517,38 @@ class TimelineAxis extends Component {
};
}
- // update scale leftOffset helper
+ /**
+ * @desc helper used in componentDidUpdate
+ * @desc update scale leftOffset
+ * @param {String} date
+ * @param {String} timeScale
+ * @param {Object} draggerCheck
+ * @returns {void}
+ */
updateScaleWithOffset = (date, timeScale, draggerCheck) => {
let leftOffsetFixedCoeff = draggerCheck.newDraggerDiff > 5 ? 0.5 : draggerCheck.newDateInThePast ? 0.25 : 0.75;
this.updateScale(date, timeScale, null, leftOffsetFixedCoeff);
}
// #### Drag/mouse handlers ####
- // changes timeScale state
+ /**
+ * @desc show hover line - additional parent conditons required
+ * @param {Event} mouse event
+ * @returns {void}
+ */
+ showHoverOn = (e) => {
+ if (!this.props.isAnimationDraggerDragging && !this.props.isTimelineDragging) {
+ if (e.target.className.animVal === 'grid') {
+ this.props.showHoverOn();
+ }
+ }
+ }
+
+ /**
+ * @desc changes timeScale with wheel scroll
+ * @param {Event} wheel scroll event
+ * @returns {void}
+ */
wheelZoom = (e) => {
let { timeScale, hasSubdailyLayers, changeTimeScale } = this.props;
let timeScaleNumber = Number(timeScaleToNumberKey[timeScale]);
@@ -502,14 +568,21 @@ class TimelineAxis extends Component {
}
}
- // set mouseDown to handle over dragging range-select and triggering false axis click
+ /**
+ * @desc set mouseDown to handle over dragging range-select and triggering false axis click
+ * @returns {void}
+ */
handleMouseDown = () => {
this.setState({
mouseDown: true
});
}
- // move dragger on axis click
+ /**
+ * @desc move dragger on axis click
+ * @param {Event} mouse click event
+ * @returns {void}
+ */
setLineTime = (e) => {
e.preventDefault();
e.stopPropagation();
@@ -549,16 +622,26 @@ console.log(hoverTime)
}
}
- // handle start drag of axis
- handleStartDrag = () => {
- this.setState({
- isTimelineDragging: true
- });
+ /**
+ * @desc handle start drag of axis sets dragging state
+ * @returns {void}
+ */
+ handleStartDrag = (e, d) => {
+ console.log(e, d)
+ // this.setState({
+ // isTimelineDragging: true
+ // });
}
- // drag axis - will update date range if dragged into past/future past dragSentinelChangeNumber
+ /**
+ * @desc drag axis - will update date range if dragged into past/future past dragSentinelChangeNumber
+ * @param {Event} mouse event
+ * @param {Object} draggable delta object
+ * @returns {void}
+ */
handleDrag = (e, d) => {
- console.log(e, d)
+ console.log(util.browser.mobileAndTabletDevice)
+ // console.log(e, d, e.targetTouches, e.targetTouches[0])
e.stopPropagation();
e.preventDefault();
let {
@@ -765,10 +848,14 @@ console.log(hoverTime)
}
}
- // handle stop drag of axis
- // moved === false means an axis click
+ /**
+ * @desc handle stop drag of axis. moved === false means an axis click
+ * @param {Event} mouse event
+ * @param {Object} draggable delta object
+ * @returns {void}
+ */
handleStopDrag = (e, d) => {
- console.log(e,d)
+ // console.log(e,d)
let {
midPoint,
leftBound,
@@ -796,6 +883,7 @@ console.log(hoverTime)
}
transformX = transformX + position;
+ console.log(moved, midPoint, position, leftBound, rightBound, d.x, d)
let updatePositioningArguments = {
moved,
isTimelineDragging: false,
@@ -899,9 +987,6 @@ console.log(hoverTime)
rightBound
} = this.state;
- // ! WINDOW.MOMENT FOR DEV DEBUG ONLY
- window.moment = moment;
- // console.log(this.props)
return (
<React.Fragment>
<div className='timeline-axis-container'
@@ -909,10 +994,11 @@ console.log(hoverTime)
onMouseDown={this.handleMouseDown}
onMouseUp={this.setLineTime}
onWheel={this.wheelZoom}
- onMouseOver={this.props.showHoverOn}
+ onMouseOver={this.showHoverOn}
onMouseLeave={this.props.showHoverOff}
- onTouchStart={this.handleMouseDown}
- onTouchEnd={this.setLineTime}
+ // onTouchMove={() => console.log('onTouchMove')}
+ // onTouchStart={this.handleMouseDown}
+ // onTouchEnd={() => console.log('onTouchEnd')}
>
{currentTimeRange
? <svg className='timeline-axis-svg'
@@ -933,12 +1019,13 @@ console.log(hoverTime)
</defs>
<Draggable
axis='x'
+ onTouchMove={() => console.log('onTouchMoveXXX')}
onDrag={this.handleDrag}
position={{ x: position, y: 0 }}
onStart={this.handleStartDrag}
onStop={this.handleStopDrag}
- onTouchStart={this.handleStartDrag}
- onTouchEnd={this.handleStopDrag}
+ // onTouchStart={this.handleStartDrag}
+ // onTouchEnd={this.handleStopDrag}
bounds={{ left: leftBound, top: 0, bottom: 0, right: rightBound }}
>
<g>
diff --git a/web/js/components/timeline/timeline-axis/timeline-dragger.js b/web/js/components/timeline/timeline-axis/timeline-dragger.js
index 1a5e3444d..1bd78280c 100644
--- a/web/js/components/timeline/timeline-axis/timeline-dragger.js
+++ b/web/js/components/timeline/timeline-axis/timeline-dragger.js
@@ -11,28 +11,44 @@ import Draggable from 'react-draggable';
class Dragger extends PureComponent {
constructor(props) {
super(props);
+
this.selectDragger = this.selectDragger.bind(this);
this.handleDragDragger = this.handleDragDragger.bind(this);
this.startShowDraggerTime = this.startShowDraggerTime.bind(this);
this.stopShowDraggerTime = this.stopShowDraggerTime.bind(this);
};
- // Select between A 'selected' or B 'selectedB'
+ /**
+ * @desc Select between A 'selected' or B 'selectedB'
+ * @param {Event} mouse event
+ * @returns {void}
+ */
selectDragger = (e) => {
this.props.selectDragger(this.props.draggerName, e);
};
- // Handles deltaX changes on dragging
+ /**
+ * @desc Handles deltaX changes on dragging
+ * @param {Event} mouse event
+ * @param {Object} draggable delta object
+ * @returns {void}
+ */
handleDragDragger = (e, d) => {
- this.props.handleDragDragger(this.props.draggerName, e, d);
+ this.props.handleDragDragger(e, d);
};
- // Show dragger tooltip on start dragging
+ /**
+ * @desc Show dragger tooltip on start dragging
+ * @returns {void}
+ */
startShowDraggerTime = () => {
this.props.toggleShowDraggerTime(true);
};
- // Hide dragger tooltip on stop dragging
+ /**
+ * @desc Hide dragger tooltip on stop dragging
+ * @returns {void}
+ */
stopShowDraggerTime = () => {
this.props.toggleShowDraggerTime(false);
};
@@ -45,55 +61,56 @@ class Dragger extends PureComponent {
compareModeActive,
disabled
} = this.props;
-
return (
- <Draggable
- axis='x'
- onMouseDown={this.selectDragger}
- onDrag={this.handleDragDragger}
- position={{ x: draggerPosition - 12, y: -20 }}
- onStart={this.startShowDraggerTime}
- onStop={this.stopShowDraggerTime}
- disabled={disabled}
- >
- <g
- style={{
- cursor: 'pointer',
- display: draggerVisible ? 'block' : 'none'
- }}
- className='gridShell dragger'
- transform={`translate(${transformX}, 0)`}
+ draggerVisible
+ ? <Draggable
+ axis='x'
+ onMouseDown={this.selectDragger}
+ onDrag={this.handleDragDragger}
+ position={{ x: draggerPosition - 12, y: -20 }}
+ onStart={this.startShowDraggerTime}
+ onStop={this.stopShowDraggerTime}
+ disabled={disabled}
>
- <polygon
- fill={disabled ? '#7a7a7a' : '#ccc'}
- stroke='#333'
- strokeWidth='1px'
- points='60,20, 90,65, 30,65'>
- </polygon>
- {compareModeActive
- ? <text
- fontSize='30px'
- fontWeight='400'
- x='11'
- y='48'
- fill={disabled ? '#ccc' : '#000'}
- transform='translate(39, 10)'
- textRendering='optimizeLegibility'
- clipPath='url(#textDisplay)'>
- {draggerName === 'selected' ? 'A' : 'B'}
- </text>
- : <React.Fragment>
- <rect
- pointerEvents='none' fill='#515151'
- width='3' height='20' x='52' y='39'></rect>
- <rect pointerEvents='none' fill='#515151'
- width='3' height='20' x='58' y='39'></rect>
- <rect pointerEvents='none' fill='#515151'
- width='3' height='20' x='64' y='39'></rect>
- </React.Fragment>
- }
- </g>
- </Draggable>
+ <g
+ style={{
+ cursor: 'pointer',
+ display: draggerVisible ? 'block' : 'none'
+ }}
+ className='gridShell dragger'
+ transform={`translate(${transformX}, 0)`}
+ >
+ <polygon
+ fill={disabled ? '#7a7a7a' : '#ccc'}
+ stroke='#333'
+ strokeWidth='1px'
+ points='60,20, 90,65, 30,65'>
+ </polygon>
+ {compareModeActive
+ ? <text
+ fontSize='30px'
+ fontWeight='400'
+ x='11'
+ y='48'
+ fill={disabled ? '#ccc' : '#000'}
+ transform='translate(39, 10)'
+ textRendering='optimizeLegibility'
+ clipPath='url(#textDisplay)'>
+ {draggerName === 'selected' ? 'A' : 'B'}
+ </text>
+ : <React.Fragment>
+ <rect
+ pointerEvents='none' fill='#515151'
+ width='3' height='20' x='52' y='39'></rect>
+ <rect pointerEvents='none' fill='#515151'
+ width='3' height='20' x='58' y='39'></rect>
+ <rect pointerEvents='none' fill='#515151'
+ width='3' height='20' x='64' y='39'></rect>
+ </React.Fragment>
+ }
+ </g>
+ </Draggable>
+ : null
);
}
}
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 eb22585b7..b1599da35 100644
--- a/web/js/components/timeline/timeline-controls/interval-timescale-change.js
+++ b/web/js/components/timeline/timeline-controls/interval-timescale-change.js
@@ -33,7 +33,7 @@ class TimeScaleIntervalChange extends PureComponent {
}
// handle click zoom of timescale intervals
- handleClickZoom = (timescale, openDialog) => {
+ handleClickZoom = (timescale, openDialog = false) => {
// send props function to change timescale zoom level throughout app
this.setState({
toolTipHovered: false
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 16afeda75..5ce09b800 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -2,22 +2,25 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import moment from 'moment';
+import lodashDebounce from 'lodash/debounce';
+import util from '../../util/util';
+
import ErrorBoundary from '../../containers/error-boundary';
-import TimeScaleIntervalChange from '../../components/timeline/timeline-controls/interval-timescale-change';
-// import '../../components/timeline/timeline.css';
+import MobileDatePicker from '../../components/timeline/mobile-date-picker';
+
import TimelineAxis from '../../components/timeline/timeline-axis/timeline-axis';
-import TimelineRangeSelector from '../../components/range-selection/range-selection';
+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 util from '../../util/util';
+
import DateSelector from '../../components/date-selector/date-selector';
-import MobileDatePicker from '../../components/timeline/mobile-date-picker';
import DateChangeArrows from '../../components/timeline/timeline-controls/date-change-arrows';
import AnimationButton from '../../components/timeline/timeline-controls/animation-button';
import AxisTimeScaleChange from '../../components/timeline/timeline-controls/axis-timescale-change';
+import TimelineRangeSelector from '../../components/range-selection/range-selection';
import { debounce as lodashDebounce, get as lodashGet } from 'lodash';
import {
@@ -51,13 +54,6 @@ import {
const ANIMATION_DELAY = 500;
-const MARGIN = {
- top: 0,
- right: 50,
- bottom: 20,
- left: 30
-};
-
class Timeline extends React.Component {
constructor(props) {
super(props);
@@ -102,7 +98,12 @@ class Timeline extends React.Component {
}
// ! HOVER TIME
- // display date based on hover grid tile
+ /**
+ * @desc display date based on hover grid tile
+ * @param {String} date
+ * @param {Number} leftOffset
+ * @returns {void}
+ */
displayDate = (date, leftOffset) => {
console.log(date, leftOffset)
requestAnimationFrame(() => {
@@ -113,21 +114,23 @@ class Timeline extends React.Component {
});
}
- // show hover line
- showHoverOn = (e) => {
- console.log(e)
- if (!this.state.isAnimationDraggerDragging && !this.state.showDraggerTime && !this.state.isTimelineDragging) {
- if (e.target.className.animVal === 'grid') {
- if (this.state.showHoverLine !== true) {
- this.setState({
- showHoverLine: true
- });
- }
- }
+ /**
+ * @desc show hover line
+ * @param {Event} mouse event
+ * @returns {void}
+ */
+ showHoverOn = () => {
+ if (!this.state.showHoverLine && !this.state.showDraggerTime) {
+ this.setState({
+ showHoverLine: true
+ });
}
}
- // hide hover line
+ /**
+ * @desc hide hover line
+ * @returns {void}
+ */
showHoverOff = () => {
if (this.state.showHoverLine === true) {
this.setState({
@@ -136,7 +139,11 @@ class Timeline extends React.Component {
}
}
- // toggle dragger time on/off
+ /**
+ * @desc toggle dragger time on/off
+ * @param {Boolean} toggleBoolean
+ * @returns {void}
+ */
toggleShowDraggerTime = (toggleBoolean) => {
this.setState({
showDraggerTime: toggleBoolean,
@@ -145,7 +152,14 @@ class Timeline extends React.Component {
});
}
- // handle svg blue line hover
+ /**
+ * @desc handle svg blue line axis hover
+ * @param {Event} mouse event
+ * @param {String} itemDate
+ * @param {String} nextDate
+ * @param {Number} index
+ * @returns {void}
+ */
showHover = (e, itemDate, nextDate, index) => {
console.log(e, e.type, itemDate, nextDate, index)
e.preventDefault();
@@ -197,7 +211,23 @@ class Timeline extends React.Component {
});
}
- // handles dynamic position changes from axis that affect dragger and range select
+ /**
+ * @desc handles dynamic position changes from axis that affect dragger and range select
+ * @param {Object} args
+ * @param {Boolean} moved
+ * @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
+ * @returns {void}
+ */
updatePositioning = ({
moved,
isTimelineDragging,
@@ -233,10 +263,9 @@ class Timeline extends React.Component {
>>>>>>> fix anim date inputs, continue large refactor and clean up
/**
- * Clear animateByIncrement's Timeout
- *
- * @return {void}
- */
+ * @desc stop animation from left/right arrows - clear animateByIncrement's timeout
+ * @returns {void}
+ */
stopper = () => {
clearInterval(this.animator);
this.animator = 0;
@@ -245,14 +274,10 @@ class Timeline extends React.Component {
});
};
/**
- * Add timeout to date change when buttons are being held so that
- * date changes don't happen too quickly
- *
- * @todo Create smart precaching so animation is smooth
- *
- * @param {number} delta Amount of time to change
- * @param {String} increment Zoom level of timeline
- * e.g. months,minutes, years, days
+ * @desc Add timeout to date change when buttons are being held so that
+ * date changes don't happen too quickly
+ * @param {Number} delta Amount of time to change
+ * @param {String} increment Zoom level of timeline e.g. months,minutes, years, days
* @return {void}
*/
animateByIncrement = (delta, increment) => {
@@ -276,99 +301,121 @@ class Timeline extends React.Component {
animate();
};
- // show/hide custom interval modal
+ /**
+ * @desc show/hide custom interval modal
+ * @returns {void}
+ */
toggleCustomIntervalModal = () => {
this.setState(prevState => ({
customIntervalModalOpen: !prevState.customIntervalModalOpen
}));
};
- // Change the timescale parent state
- changeTimeScale = timeScaleNumber => {
- this.props.changeTimeScale(timeScaleNumber);
+ /**
+ * @desc Change the timescale parent state
+ * @param {Number} timeScaleNumber
+ * @returns {void}
+ */
+ changeTimeScale = (timeScale) => {
+ this.props.changeTimeScale(timeScale);
};
- // handle SET of custom time scale panel
+ /**
+ * @desc handle SET of custom time scale panel
+ * @param {Number} delta
+ * @param {Number} timeScale
+ * @returns {void}
+ */
changeCustomInterval = (delta, timeScale) => {
- this.props.changeCustomInterval(Number(delta), Number(timeScale));
+ this.props.changeCustomInterval(delta, timeScale);
};
- // handle SELECT of LEFT/RIGHT interval selection
- setTimeScaleIntervalChangeUnit = (
- intervalSelected,
- customIntervalModalOpen
- ) => {
+ /**
+ * @desc handle SELECT of LEFT/RIGHT interval selection
+ * @param {String} timeScale
+ * @param {Boolean} modalOpen - is custom interval modal open
+ * @returns {void}
+ */
+ setTimeScaleIntervalChangeUnit = (timeScale, modalOpen) => {
let delta;
- let {
- customIntervalZoomLevel,
- customIntervalValue,
- selectInterval
- } = this.props;
- let customSelected = intervalSelected === 'custom';
+ let { customIntervalZoomLevel, customIntervalValue } = this.props;
+ let customSelected = timeScale === 'custom';
if (customSelected && customIntervalZoomLevel && customIntervalValue) {
- intervalSelected = customIntervalZoomLevel;
+ timeScale = customIntervalZoomLevel;
delta = customIntervalValue;
} else {
- intervalSelected = Number(timeScaleToNumberKey[intervalSelected]);
+ timeScale = Number(timeScaleToNumberKey[timeScale]);
delta = 1;
}
- selectInterval(delta, intervalSelected, customSelected);
+ this.props.selectInterval(delta, timeScale, customSelected);
this.setState({
- customIntervalModalOpen: !!customIntervalModalOpen
+ customIntervalModalOpen: modalOpen
});
};
- // right arrow increment date
+ /**
+ * @desc right arrow increment date
+ * @returns {void}
+ */
incrementDate = () => {
let delta = this.props.customSelected ? this.props.intervalChangeAmt : 1;
this.animateByIncrement(Number(delta), this.props.timeScaleChangeUnit);
};
- // left arrow decrement date
+ /**
+ * @desc left arrow decrement date
+ * @returns {void}
+ */
decrementDate = () => {
let delta = this.props.customSelected ? this.props.intervalChangeAmt : 1;
this.animateByIncrement(Number(delta * -1), this.props.timeScaleChangeUnit);
};
- // open animation dialog
+ /**
+ * @desc open animation wdiget
+ * @returns {void}
+ */
clickAnimationButton = () => {
if (this.props.isAnimationWidgetOpen) {
this.props.closeAnimation();
} else {
this.props.openAnimation();
}
- // Will be a setState({})
- // a deriveStateFromProps will be wanted with this one
};
- // toggle hide timeline
+ /**
+ * @desc toggle hide timeline
+ * @returns {void}
+ */
toggleHideTimeline = () => {
this.setState({
timelineHidden: !this.state.timelineHidden
});
};
- // toggle selected dragger for comparison mode/focused date used in date selector
- onChangeSelectedDragger = () => {
- this.props.toggleActiveCompareState();
- };
-
- // handles left/right arrow down to decrement/increment date
- handleKeyDown = lodashDebounce(
- e => {
- if (e.keyCode === 37) {
- this.decrementDate();
- e.preventDefault();
- } else if (e.keyCode === 39) {
- this.incrementDate();
- e.preventDefault();
- }
- },
- 0,
- { leading: true, trailing: false }
+ /**
+ * @desc handles left/right arrow down to decrement/increment date
+ * @param {Event} mouse event
+ * @returns {void}
+ */
+ handleKeyDown = lodashDebounce(e => {
+ if (e.keyCode === 37) {
+ this.decrementDate();
+ e.preventDefault();
+ } else if (e.keyCode === 39) {
+ this.incrementDate();
+ e.preventDefault();
+ }
+ },
+ 0,
+ { leading: true, trailing: false }
);
- // handles stopping change date in process and to allow faster key downs
+ /**
+ * @desc handles stopping change date in process and to allow faster key downs
+ * @param {Event} mouse event
+ * @returns {void}
+ */
handleKeyUp = e => {
if (e.keyCode === 37 || e.keyCode === 39) {
this.stopper();
@@ -376,36 +423,55 @@ class Timeline extends React.Component {
}
};
- // handle animation date updates
- updateAnimationDateAndLocation = (animationStartLocationDate, animationEndLocationDate, animationStartLocation, animationEndLocation, isDragging) => {
+ /**
+ * @desc handle animation date dragger updates
+ * @param {String} startDate
+ * @param {String} endDate
+ * @param {Number} startLocation
+ * @param {Number} endLocation
+ * @param {Boolean} isDragging
+ * @returns {void}
+ */
+ updateAnimationDateAndLocation = (startDate, endDate, startLocation, endLocation, isDragging) => {
this.setState({
- animationStartLocation: animationStartLocation || this.state.animationStartLocation,
- animationEndLocation: animationEndLocation || this.state.animationEndLocation,
- animationStartLocationDate: animationStartLocationDate,
- animationEndLocationDate: animationEndLocationDate,
+ animationStartLocation: startLocation || this.state.animationStartLocation,
+ animationEndLocation: endLocation || this.state.animationEndLocation,
+ animationStartLocationDate: startDate,
+ animationEndLocationDate: endDate,
isAnimationDraggerDragging: isDragging
});
- this.determineAnimationDraggerUpdate(animationStartLocationDate, animationEndLocationDate);
+ this.determineAnimationDraggerUpdate(startDate, endDate);
}
- determineAnimationDraggerUpdate = (animationStartLocationDate, animationEndLocationDate) => {
- let startChanged = this.props.animationStartLocationDate !== animationStartLocationDate;
- let endChanged = this.props.animationEndLocationDate !== animationEndLocationDate;
+ /**
+ * @desc handle animation date dragger updates of startDate, endDate, or both
+ * @param {String} startDate
+ * @param {String} endDate
+ * @returns {void}
+ */
+ determineAnimationDraggerUpdate = (startDate, endDate) => {
+ let startChanged = this.props.animationStartLocationDate !== startDate;
+ let endChanged = this.props.animationEndLocationDate !== endDate;
if (startChanged) {
if (endChanged) {
- this.debounceOnUpdateStartAndEndDate(animationStartLocationDate, animationEndLocationDate);
+ this.debounceOnUpdateStartAndEndDate(startDate, endDate);
} else {
- this.debounceOnUpdateStartDate(animationStartLocationDate);
+ this.debounceOnUpdateStartDate(startDate);
}
} else {
if (endChanged) {
- this.debounceOnUpdateEndDate(animationEndLocationDate);
+ this.debounceOnUpdateEndDate(endDate);
}
}
}
- // handle animation dragger location update and state update
- animationDraggerDateUpdate = (animationStartLocationDate, animationEndLocationDate) => {
+ /**
+ * @desc handle animation dragger location update and state update
+ * @param {String} startDate
+ * @param {String} endDate
+ * @returns {void}
+ */
+ animationDraggerDateUpdate = (startDate, endDate) => {
let { position, transformX } = this.state;
let { timeScale } = this.props;
@@ -413,19 +479,31 @@ class Timeline extends React.Component {
let gridWidth = options.gridWidth;
let frontDate = moment.utc(this.state.frontDate);
- let startLocation = frontDate.diff(animationStartLocationDate, timeScale, true) * gridWidth;
- let endLocation = frontDate.diff(animationEndLocationDate, timeScale, true) * gridWidth;
+ let startLocation = frontDate.diff(startDate, timeScale, true) * gridWidth;
+ let endLocation = frontDate.diff(endDate, timeScale, true) * gridWidth;
this.setState({
animationStartLocation: position - startLocation + transformX,
animationEndLocation: position - endLocation + transformX,
- animationStartLocationDate: animationStartLocationDate,
- animationEndLocationDate: animationEndLocationDate
+ animationStartLocationDate: startDate,
+ animationEndLocationDate: endDate
});
- this.debounceOnUpdateStartAndEndDate(animationStartLocationDate, animationEndLocationDate);
+ this.debounceOnUpdateStartAndEndDate(startDate, endDate);
}
// ! DRAGGER
+ /**
+ * @desc update state dragger position and if new date, change store date
+ * @param {String} newDraggerDate
+ * @param {String} draggerSelected
+ * @param {Number} draggerPosition
+ * @param {Boolean} draggerVisible
+ * @param {Boolean} otherDraggerVisible
+ * @param {Boolean} moved
+ * @returns {void}
+ */
updateDraggerDatePosition = (newDraggerDate, draggerSelected, draggerPosition, draggerVisible, otherDraggerVisible, moved) => {
+ console.log(this.state)
+ console.log(newDraggerDate, draggerSelected, draggerPosition, draggerVisible, otherDraggerVisible, moved)
if (draggerSelected === 'selected') {
this.setState({
draggerPosition: draggerPosition || this.state.draggerPosition,
@@ -451,6 +529,12 @@ class Timeline extends React.Component {
}
}
+ /**
+ * @desc set dragger visibility
+ * @param {Boolean} draggerVisible
+ * @param {Boolean} draggerVisibleB
+ * @returns {void}
+ */
setDraggerVisibility = (draggerVisible, draggerVisibleB) => {
this.setState({
draggerVisible,
@@ -500,6 +584,12 @@ class Timeline extends React.Component {
});
}
+ /**
+ * @desc change store date
+ * @param {String} date
+ * @param {String} draggerSelected
+ * @returns {void}
+ */
changeDate = (date, draggerSelected = this.state.draggerSelected) => {
this.debounceDateUpdate(new Date(date), draggerSelected);
}
@@ -529,144 +619,14 @@ class Timeline extends React.Component {
} = this.props;
let selectedDate = draggerSelected === 'selected' ? this.state.draggerTimeState : this.state.draggerTimeStateB;
return this.state.initialLoadComplete ? (
- <ErrorBoundary>
-<<<<<<< HEAD
- <section id="timeline" className="timeline-inner clearfix">
- <div id="timeline-header"
- className={hasSubdailyLayers ? 'subdaily' : ''}
- >
- <div id="date-selector-main">
- <DateSelector
- onDateChange={this.changeDate}
- 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}
- hasSubdailyLayers={hasSubdailyLayers}
- changeTimeScale={this.changeTimeScale}
- compareModeActive={compareModeActive}
- draggerSelected={draggerSelected}
- onChangeSelectedDragger={this.onChangeSelectedDragger}
- 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}
- />
-
- <HoverLine
- width={axisWidth}
- isTimelineDragging={this.state.isTimelineDragging}
- showHoverLine={this.state.showHoverLine}
- hoverLinePosition={this.state.hoverLinePosition}
- />
-
- {isAnimationWidgetOpen
- ? <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
- }
-<<<<<<< HEAD
-=======
-
->>>>>>> fix anim date inputs, continue large refactor and clean up
- {this.state.frontDate
- ? <DraggerContainer
- position={this.state.position}
- timelineStartDateLimit={timelineStartDateLimit}
- timelineEndDateLimit={timelineEndDateLimit}
- timeScale={timeScale}
-=======
+ <ErrorBoundary>
{this.props.isSmallScreen
? <MobileDatePicker
date={selectedDate}
startDateLimit={timelineStartDateLimit}
endDateLimit={timelineEndDateLimit}
hasSubdailyLayers={this.props.hasSubdailyLayers}
- changeDate={this.changeDate}
+ onDateChange={this.onDateChange}
/>
: <section id="timeline" className="timeline-inner clearfix">
<div id="timeline-header"
@@ -674,7 +634,7 @@ class Timeline extends React.Component {
>
<div id="date-selector-main">
<DateSelector
- onDateChange={this.changeDate}
+ onDateChange={this.onDateChange}
date={new Date(selectedDate)}
hasSubdailyLayers={hasSubdailyLayers}
draggerSelected={draggerSelected}
@@ -713,7 +673,6 @@ class Timeline extends React.Component {
>
{/* Timeline */}
<TimelineAxis
->>>>>>> add mobile date picker, WIP mobile and tablet drag handling
frontDate={this.state.frontDate}
backDate={this.state.backDate}
isTimelineDragging={this.state.isTimelineDragging}
@@ -725,7 +684,7 @@ class Timeline extends React.Component {
changeTimeScale={this.changeTimeScale}
compareModeActive={compareModeActive}
draggerSelected={draggerSelected}
- onChangeSelectedDragger={this.onChangeSelectedDragger}
+ onChangeSelectedDragger={this.props.toggleActiveCompareState}
timelineStartDateLimit={timelineStartDateLimit}
timelineEndDateLimit={timelineEndDateLimit}
animStartLocationDate={animStartLocationDate}
@@ -752,11 +711,13 @@ class Timeline extends React.Component {
leftOffset={this.state.leftOffset}
hoverTime={this.state.hoverTime}
isDraggerDragging={this.state.isDraggerDragging}
+ parentOffset={this.props.parentOffset}
/>
<HoverLine
width={axisWidth}
isTimelineDragging={this.state.isTimelineDragging}
+ isAnimationDraggerDragging={this.state.isAnimationDraggerDragging}
showHoverLine={this.state.showHoverLine}
hoverLinePosition={this.state.hoverLinePosition}
/>
@@ -801,7 +762,7 @@ class Timeline extends React.Component {
width={axisWidth}
setDraggerVisibility={this.setDraggerVisibility}
toggleShowDraggerTime={this.toggleShowDraggerTime}
- onChangeSelectedDragger={this.onChangeSelectedDragger}
+ onChangeSelectedDragger={this.props.toggleActiveCompareState}
updateDraggerDatePosition={this.updateDraggerDatePosition}
compareModeActive={compareModeActive}
// draggerTimeState={dateA}
@@ -856,14 +817,14 @@ class Timeline extends React.Component {
{/* 🍔 Open/Close Chevron 🍔 */}
<div id="timeline-hide" onClick={this.toggleHideTimeline}>
<div
- className={`wv-timeline-hide wv-timeline-hide-double-chevron-${
+ clErrorBoundaryassName={`wv-timeline-hide wv-timeline-hide-double-chevron-${
this.state.timelineHidden ? 'left' : 'right'
}`}
/>
</div>
</section>
}
- </ErrorBoundary>
+ </>
) : null;
}
}
@@ -1058,8 +1019,7 @@ Timeline.propTypes = {
// get axisWidth and parentOffset for axis, footer, and leftOffset calculations
const getOffsetValues = (innerWidth, hasSubDaily) => {
const parentOffset = (hasSubDaily ? 414 : 310) + 10;
- const width =
- innerWidth - parentOffset - 20 - 20 - MARGIN.left - MARGIN.right + 28;
+ const width = innerWidth - parentOffset - 92;
return { width, parentOffset };
};