Interactive interface for browsing global, full-resolution satellite imagery
add horizontal touch scroll for axis, clean up includes dead code removal, class naming consistency, and update logic fixes
Edward Plato64d8010ad8d0
diff --git a/web/js/components/timeline/timeline-axis/date-tooltips.js b/web/js/components/timeline/timeline-axis/date-tooltips.jsindex 47596e56f..26d082343 100644--- a/web/js/components/timeline/timeline-axis/date-tooltips.js+++ b/web/js/components/timeline/timeline-axis/date-tooltips.js@@ -58,14 +58,14 @@ class DateToolTip extends PureComponent {{(showDraggerToolTip) || (showHoverToolTip)? <div- className='dateToolTip'+ className='date-tooltip'style={{transform: `translate(${toolTipLeftOffest}px, -100px)`,display: toolTipDisplay,width: hasSubdailyLayers ? '270px' : '165px'}}>- { toolTipDate } <span className="dateToolTip-dayOfYear">({ toolTipDayOfYear })</span>+ { toolTipDate } <span className="date-tooltip-day">({ toolTipDayOfYear })</span></div>: null}diff --git a/web/js/components/timeline/timeline-axis/dragger-container.js b/web/js/components/timeline/timeline-axis/dragger-container.jsindex 4d46b5263..473d3ad51 100644--- a/web/js/components/timeline/timeline-axis/dragger-container.js+++ b/web/js/components/timeline/timeline-axis/dragger-container.js@@ -44,10 +44,14 @@ class DraggerContainer extends PureComponent {* @returns {void}*/setDraggerPosition = (inputTime) => {- let frontDate = this.props.frontDate;- let backDate = this.props.backDate;- let draggerB = this.props.draggerSelected === 'selectedB';- let draggerName = draggerB ? 'selectedB' : 'selected';+ let {+ timeScale,+ position,+ transformX,+ frontDate,+ backDate,+ draggerSelected+ } = this.props;let isBetween = getIsBetween(inputTime, frontDate, backDate);@@ -57,13 +61,12 @@ class DraggerContainer extends PureComponent {draggerVisible = true;}- let timeScale = this.props.timeScale;let options = timeScaleOptions[timeScale].timeAxis;let gridWidth = options.gridWidth;let frontDateObj = moment.utc(frontDate);let pixelsToAddToDraggerNew = Math.abs(frontDateObj.diff(inputTime, timeScale, true) * gridWidth);- newDraggerPosition = pixelsToAddToDraggerNew + this.props.position - this.state.draggerWidth + this.props.transformX + 2;- this.props.updateDraggerDatePosition(null, draggerName, newDraggerPosition, draggerVisible);+ newDraggerPosition = pixelsToAddToDraggerNew + position - this.state.draggerWidth + transformX + 2;+ this.props.updateDraggerDatePosition(null, draggerSelected, newDraggerPosition, draggerVisible);}/**@@ -78,43 +81,49 @@ class DraggerContainer extends PureComponent {e.preventDefault();}- // requestAnimationFrame(() => {+ requestAnimationFrame(() => {var deltaX = d.deltaX;+ // if no movement, RETURN out of functionif (deltaX === 0) {return false;}- let timeScale = this.props.timeScale;-+ let {+ timeScale,+ draggerSelected,+ draggerTimeState,+ draggerTimeStateB,+ draggerPosition,+ draggerPositionB,+ frontDate,+ position,+ transformX,+ timelineStartDateLimit,+ timelineEndDateLimit+ } = this.props;++ // get timescale specific options for scaleMs and gridWidthlet options = timeScaleOptions[timeScale].timeAxis;let gridWidth = options.gridWidth;- // 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';- if (draggerASelected) { // 'selected is 'A' dragger- draggerPosition = this.props.draggerPosition + deltaX;- time = this.props.draggerTimeState;+ let draggerTime;+ let newDraggerPosition;+ let newDraggerTime;+ if (draggerSelected === 'selected') { // 'selected is 'A' dragger+ newDraggerPosition = draggerPosition + deltaX;+ draggerTime = draggerTimeState;} else { // 'selectedB' is 'B' dragger- draggerPosition = this.props.draggerPositionB + deltaX;- time = this.props.draggerTimeStateB;+ newDraggerPosition = draggerPositionB + deltaX;+ draggerTime = draggerTimeStateB;}// update draggerTime based on deltaX from state draggerTime- let draggerTimeValue = new Date(time).getTime();+ let draggerTimeValue = new Date(draggerTime).getTime();// only need to calculate difference in time unit for varying timescales - month and year- let newDraggerTime;let diffZeroValues = options.scaleMs;if (!diffZeroValues) {// calculate based on frontDate due to varying number of days per month and per year (leapyears)- let frontDate = this.props.frontDate;- // ! -2 necessary from subtracting 2 from transformX in updateScale ?- // let draggerPositionRelativeToFrontDate = this.state.draggerWidth - 2 + draggerPosition - this.state.position - this.state.transformX;- let draggerPositionRelativeToFrontDate = this.state.draggerWidth - 2 + draggerPosition - this.props.position - this.props.transformX;+ let draggerPositionRelativeToFrontDate = this.state.draggerWidth - 2 + newDraggerPosition - position - transformX;let gridWidthCoef = draggerPositionRelativeToFrontDate / gridWidth;let draggerDateAdded = moment.utc(frontDate).add((Math.floor(gridWidthCoef)), timeScale);@@ -132,104 +141,26 @@ class DraggerContainer extends PureComponent {newDraggerTime = draggerTimeValue + (diffFactor * deltaX);}- // check if new dragger date is within valid date range- let isBetweenValidTimeline = getIsBetween(newDraggerTime, this.props.timelineStartDateLimit, this.props.timelineEndDateLimit);+ // check if new dragger date is within valid date range and format or RETURN out of function+ let isBetweenValidTimeline = getIsBetween(newDraggerTime, timelineStartDateLimit, timelineEndDateLimit);if (isBetweenValidTimeline) {newDraggerTime = getISODateFormatted(newDraggerTime);} else {return false;}- // handle drag timeline- // // TODO: fix drag off current view - doesn't drag/update date of hover properly- // if (draggerPosition < -draggerWidth) { // # handle drag timeline towards PAST- // // console.log('drag off view past', deltaX, (dragSentinelCount + deltaX), -dragSentinelChangeNumber)- // let position = this.state.position - deltaX;-- // if ((dragSentinelCount + deltaX) < -dragSentinelChangeNumber) {- // // console.log('drag off view past UNSHIFT TILES')- // let overDrag = 0;- // if ((dragSentinelCount + deltaX) < -dragSentinelChangeNumber - dragSentinelChangeNumber) {- // overDrag = Math.abs((dragSentinelCount + deltaX) - -dragSentinelChangeNumber - -dragSentinelChangeNumber);- // }- // //# NEED TO PASS NEGATIVE OF DELTAX FOR UPDATE PANEL- // let { currentTimeRange,- // deque,- // transformX,- // draggerVisible,- // draggerVisibleB,- // overDragGrids,- // draggerPositionRevision } = this.updatePanelDateRange(position, timeScale, -deltaX, draggerPosition, overDrag);-- // this.setState({- // currentTimeRange: currentTimeRange,- // deque: deque,- // transformX: transformX,- // draggerPosition: -48,- // moved: true,- // position: position,- // dragSentinelCount: (dragSentinelCount + deltaX) - -dragSentinelChangeNumber + (overDragGrids * gridWidth),- // })- // } else {- // let newDragSentinelCount = dragSentinelCount > 0 ? (-dragSentinelChangeNumber + dragSentinelCount + deltaX) : dragSentinelCount + deltaX;-- // // NEGATIVE DELTAX- // this.setState({- // draggerPosition: -48,- // moved: true,- // position: position,- // dragSentinelCount: newDragSentinelCount- // })- // }- // } else if (draggerPosition > axisWidth - draggerWidth) { // handle drag timeline towards FUTURE- // // console.log('drag off view future', deltaX)- // let position = this.state.position - deltaX;-- // if ((dragSentinelCount + deltaX) > dragSentinelChangeNumber) {-- // let overDrag = 0;- // if ((dragSentinelCount + deltaX) > dragSentinelChangeNumber + dragSentinelChangeNumber) {- // overDrag = Math.abs((dragSentinelCount + deltaX) - dragSentinelChangeNumber - dragSentinelChangeNumber);- // }- // //# NEED TO PASS NEGATIVE OF DELTAX FOR UPDATE PANEL- // let { currentTimeRange,- // deque,- // transformX,- // draggerVisible,- // draggerVisibleB,- // overDragGrids,- // draggerPositionRevision } = this.updatePanelDateRange(position, timeScale, -deltaX, draggerPosition, overDrag);-- // this.setState({- // currentTimeRange: currentTimeRange,- // deque: deque,- // transformX: transformX,- // draggerPosition: axisWidth - 50,- // moved: true,- // position: position,- // dragSentinelCount: (dragSentinelCount + deltaX) - dragSentinelChangeNumber - (overDragGrids * gridWidth),- // })-- // } else {- // let newDragSentinelCount = dragSentinelCount < 0 ? (dragSentinelChangeNumber + dragSentinelCount + deltaX) : dragSentinelCount + deltaX;-- // // POSITIVE DELTAX- // this.setState({- // draggerPosition: axisWidth - 50,- // moved: true,- // position: position,- // dragSentinelCount: newDragSentinelCount- // })- // }- // } else { // handle drag within axis view-- this.props.updateDraggerDatePosition(newDraggerTime, draggerName, draggerPosition, null, null, true);+ this.props.updateDraggerDatePosition(newDraggerTime, draggerSelected, newDraggerPosition, null, null, true);+ });}componentDidUpdate(prevProps, prevState) {- let { draggerTimeState, draggerTimeStateB } = this.props;- let { isDraggerDragging } = this.props;- let { dateA, dateB, draggerSelected, compareModeActive } = this.props;+ let {+ draggerTimeState,+ draggerTimeStateB,+ isDraggerDragging,+ draggerSelected,+ compareModeActive+ } = this.props;// handle dragger visibility update on compare mode activate/deactivateif (compareModeActive !== prevProps.compareModeActive) {@@ -258,43 +189,6 @@ class DraggerContainer extends PureComponent {}}- // shouldComponentUpdate(nextProps) {- // let {- // draggerTimeState,- // draggerTimeStateB,- // dateA,- // dateB,- // draggerSelected,- // width,- // transformX,- // compareModeActive,- // draggerPosition,- // draggerPositionB,- // draggerVisible,- // draggerVisibleB- // } = this.props;-- // let checkForPropsUpdates = (- // nextProps.draggerTimeState === draggerTimeState &&- // nextProps.draggerTimeStateB === draggerTimeStateB &&- // nextProps.dateA === dateA &&- // nextProps.dateB === dateB &&- // nextProps.draggerSelected === draggerSelected &&- // nextProps.width === width &&- // nextProps.transformX === transformX &&- // nextProps.compareModeActive === compareModeActive &&- // nextProps.draggerPosition === draggerPosition &&- // nextProps.draggerPositionB === draggerPositionB &&- // nextProps.draggerVisible === draggerVisible &&- // nextProps.draggerVisibleB === draggerVisibleB- // );-- // if (checkForPropsUpdates) {- // return false;- // }- // return true;- // }-render() {let {draggerSelected,@@ -311,7 +205,9 @@ class DraggerContainer extends PureComponent {let sharedProps = {toggleShowDraggerTime,transformX,- compareModeActive+ compareModeActive,+ handleDragDragger: this.handleDragDragger,+ selectDragger: this.selectDragger};return (draggerSelected === 'selectedB'@@ -323,9 +219,6 @@ class DraggerContainer extends PureComponent {draggerName='selected'draggerPosition={draggerPosition}draggerVisible={draggerVisible}- handleDragDragger={this.handleDragDragger}- selectDragger={this.selectDragger}- toggleShowDraggerTime={toggleShowDraggerTime}/>: null}<Dragger@@ -334,9 +227,6 @@ class DraggerContainer extends PureComponent {draggerName='selectedB'draggerPosition={draggerPositionB}draggerVisible={draggerVisibleB}- handleDragDragger={this.handleDragDragger}- selectDragger={this.selectDragger}- toggleShowDraggerTime={toggleShowDraggerTime}/></svg>: <svg className="dragger-container" width={width}>@@ -347,9 +237,6 @@ class DraggerContainer extends PureComponent {draggerName='selectedB'draggerPosition={draggerPositionB}draggerVisible={draggerVisibleB}- handleDragDragger={this.handleDragDragger}- selectDragger={this.selectDragger}- toggleShowDraggerTime={toggleShowDraggerTime}/>: null}<Dragger@@ -358,9 +245,6 @@ class DraggerContainer extends PureComponent {draggerName='selected'draggerPosition={draggerPosition}draggerVisible={draggerVisible}- handleDragDragger={this.handleDragDragger}- selectDragger={this.selectDragger}- toggleShowDraggerTime={toggleShowDraggerTime}/></svg>);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.jsindex 9b4be8dd9..21681fe65 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@@ -48,7 +48,7 @@ class GridRange extends PureComponent {} = this.props;let tileTextCondition = tileTextConditionOptions[timeScale];return (- <g className="gridShell" transform={`translate(${transformX}, 0)`}>+ <g className="axis-grid-container" transform={`translate(${transformX}, 0)`}><React.Fragment>{timeRange.map((item, index) => {return (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.jsindex 4f828770f..88f751670 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@@ -90,22 +90,22 @@ class TileRect extends PureComponent {return (<React.Fragment><g onMouseMove={this.showHover}>- <rect className="grid" width={gridWidth} height={100}+ <rect className="axis-grid-rect" width={gridWidth} height={100}transform={`translate(${index * gridWidth}, 0)`}fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'}shapeRendering="optimizeSpeed"/>- <line stroke="black" strokeLinecap="round"+ <line className="axis-grid-line" stroke="black" strokeLinecap="round"strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY}transform={`translate(${index * gridWidth + 2.2}, 0)`}shapeRendering="optimizeSpeed"/>- <line stroke="#555" strokeWidth={1} x1="0" x2={gridWidth}+ <line className="axis-grid-line" stroke="#555" strokeWidth={1} x1="0" x2={gridWidth}y1="46" y2="46"transform={`translate(${index * gridWidth + 1}, 0)`}shapeRendering="optimizeSpeed"/>- <line stroke="white" strokeLinecap="round"+ <line className="axis-grid-line" stroke="white" strokeLinecap="round"strokeWidth={whiteLineStrokeWidth} x1="0" x2="0" y1="0" y2={lineLengthY}transform={`translate(${index * gridWidth + 1}, 0)`}shapeRendering="optimizeSpeed"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.jsindex 0db64085d..4623e24d0 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@@ -23,7 +23,7 @@ const axisScaleTextElementWrapper = (item, index, gridWidth) => {}return (<React.Fragment>- <text className="gridText" x="0" y="42"+ <text className="axis-grid-text" x="0" y="42"fill={item.withinRange ? 'white' : ''}transform={`translate(${(index * gridWidth) + xOffsetAdded}, 20)`}textRendering="optimizeSpeed" clipPath="url(#textDisplay)"diff --git a/web/js/components/timeline/timeline-axis/hover-line.js b/web/js/components/timeline/timeline-axis/hover-line.jsindex 3d7037a1e..86a3d57dc 100644--- a/web/js/components/timeline/timeline-axis/hover-line.js+++ b/web/js/components/timeline/timeline-axis/hover-line.js@@ -12,11 +12,14 @@ class HoverLine extends PureComponent {let {width,isTimelineDragging,+ isAnimationDraggerDragging,showHoverLine,hoverLinePosition} = this.props;+ // check for timeline/animation dragging and showhover handled by parent+ let showHover = !isTimelineDragging && !isAnimationDraggerDragging && showHoverLine;return (- !isTimelineDragging && showHoverLine+ showHover? <svg className='timeline-hover-line-container' width={width}><line className='timeline-hover-line'stroke='blue' strokeWidth='2' strokeOpacity='0.48' x1='0' x2='0' y1='0' y2='63'diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.jsindex 7aef62706..c35f34018 100644--- a/web/js/components/timeline/timeline-axis/timeline-axis.js+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js@@ -2,7 +2,6 @@ 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';@@ -33,10 +32,13 @@ class TimelineAxis extends Component {this.handleDrag = this.handleDrag.bind(this);this.handleStartDrag = this.handleStartDrag.bind(this);this.handleStopDrag = this.handleStopDrag.bind(this);- this.wheelZoom = this.wheelZoom.bind(this);+ this.handleWheel = this.handleWheel.bind(this);// axis click to set draggerthis.setLineTime = this.setLineTime.bind(this);++ // wheel event timeout+ this.wheelTimeout = 0;}/**@@ -50,6 +52,7 @@ class TimelineAxis extends Component {*/updateScale = (inputDate, timeScale, axisWidthInput, leftOffsetFixedCoeff, hoverChange) => {console.log(inputDate, timeScale, axisWidthInput, leftOffsetFixedCoeff, hoverChange)+ let minDateTimelineStartDateLimit = this.props.timelineStartDateLimit;let maxDateTimelineEndDateLimit = this.props.timelineEndDateLimit;let options = timeScaleOptions[timeScale].timeAxis;let gridWidth = options.gridWidth;@@ -72,12 +75,21 @@ class TimelineAxis extends Component {// Floating point issues need to be handled more cleanlylet midPoint = -((gridWidth * gridNumber) / 2) + ((numberOfVisibleTiles / 2) * gridWidth);- let hoverTime = moment.utc(this.props.hoverTime);+ // horizontal scroll will disable this, so use frontDate in that case+ let hoverTime = moment.utc(this.props.hoverTime || this.props.frontDate);- if (hoverTime.isAfter(maxDateTimelineEndDateLimit)) {- hoverTime = maxDateTimelineEndDateLimit;+ // handle timeline axis start/end limits+ let isBeforeStart = new Date(hoverTime) <= new Date(minDateTimelineStartDateLimit);+ if (isBeforeStart) {+ hoverTime = moment.utc(minDateTimelineStartDateLimit);+ } else {+ let isAfterEnd = new Date(hoverTime) >= new Date(maxDateTimelineEndDateLimit);+ if (isAfterEnd) {+ hoverTime = moment.utc(maxDateTimelineEndDateLimit);+ }}+ // use input date or hoverTimehoverTime = inputDate ? moment.utc(inputDate) : hoverTime;let hoverTimeZero = hoverTime.clone().startOf(timeScale);if (timeScale === 'year') {@@ -533,7 +545,7 @@ class TimelineAxis extends Component {*/showHoverOn = (e) => {if (!this.props.isAnimationDraggerDragging && !this.props.isTimelineDragging) {- if (e.target.className.animVal === 'grid') {+ if (e.target.className.animVal === 'axis-grid-rect') {this.props.showHoverOn();}}@@ -541,24 +553,97 @@ class TimelineAxis extends Component {/*** @desc changes timeScale with wheel scroll+ * y axis change - change timescale (e.g. from 'day' to 'month')+ * x axis change - horizontal scroll multi-touch* @param {Event} wheel scroll event* @returns {void}*/- wheelZoom = (e) => {+ handleWheel(e) {let { timeScale, hasSubdailyLayers, changeTimeScale } = this.props;let timeScaleNumber = Number(timeScaleToNumberKey[timeScale]);let maxTimeScaleNumber = hasSubdailyLayers ? 5 : 3;- if (e.deltaY > 0) { // wheel zoom out- if (timeScaleNumber > 1) {- this.setState({- wheelZoom: true- }, changeTimeScale(timeScaleNumber - 1));++ // handle time scale change on y axis wheel event+ if (e.deltaY !== 0) {+ if (e.deltaY > 0) { // wheel zoom out+ if (timeScaleNumber > 1) {+ this.setState({+ wheelZoom: true+ }, changeTimeScale(timeScaleNumber - 1));+ }+ } else {+ if (timeScaleNumber < maxTimeScaleNumber) { // wheel zoom in+ this.setState({+ wheelZoom: true+ }, changeTimeScale(timeScaleNumber + 1));+ }}- } else {- if (timeScaleNumber < maxTimeScaleNumber) { // wheel zoom in- this.setState({- wheelZoom: true- }, changeTimeScale(timeScaleNumber + 1));+ }+ // handle horizontal scroll on x axis wheel event+ if (e.deltaX !== 0) {+ this.handleStartDrag();+ if (e.deltaX > 0) { // mutli-touch drag left+ let scrollX = this.props.position - 100;+ if (scrollX < this.state.leftBound) { // cancel drag if exceeds axis leftBound+ clearTimeout(this.wheelTimeout);+ let updatePositioningArguments = {+ moved: false,+ isTimelineDragging: false,+ position: this.props.position,+ transformX: this.props.transformX,+ frontDate: this.props.frontDate,+ backDate: this.props.backDate,+ draggerPosition: this.props.draggerPosition,+ draggerPositionB: this.props.draggerPositionB,+ draggerVisible: this.props.draggerVisible,+ draggerVisibleB: this.props.draggerVisibleB,+ animationStartLocation: this.props.animationStartLocation,+ animationEndLocation: this.props.animationEndLocation+ };+ let hoverTime = null;+ this.props.updatePositioning(updatePositioningArguments, hoverTime);+ } else {+ let deltaObj = {+ deltaX: -100,+ x: scrollX+ };+ this.handleDrag(e, deltaObj);+ clearTimeout(this.wheelTimeout);+ this.wheelTimeout = setTimeout(() => {+ this.handleStopDrag(null, deltaObj);+ }, 100);+ }+ } else { // multi-touch drag right+ let scrollX = this.props.position + 100;+ if (scrollX > this.state.rightBound) { // cancel drag if exceeds axis rightBound+ clearTimeout(this.wheelTimeout);+ let updatePositioningArguments = {+ moved: false,+ isTimelineDragging: false,+ position: this.props.position,+ transformX: this.props.transformX,+ frontDate: this.props.frontDate,+ backDate: this.props.backDate,+ draggerPosition: this.props.draggerPosition,+ draggerPositionB: this.props.draggerPositionB,+ draggerVisible: this.props.draggerVisible,+ draggerVisibleB: this.props.draggerVisibleB,+ animationStartLocation: this.props.animationStartLocation,+ animationEndLocation: this.props.animationEndLocation+ };+ let hoverTime = null;+ this.props.updatePositioning(updatePositioningArguments, hoverTime);+ } else {+ let deltaObj = {+ deltaX: 100,+ x: scrollX+ };+ this.handleDrag(e, deltaObj);+ clearTimeout(this.wheelTimeout);+ this.wheelTimeout = setTimeout(() => {+ this.handleStopDrag(null, deltaObj);+ }, 100);+ }}}}@@ -581,10 +666,12 @@ class TimelineAxis extends Component {setLineTime = (e) => {e.preventDefault();e.stopPropagation();- if (e.target.className.animVal !== 'grid') {+ if (e.target.className.animVal !== 'axis-grid-rect') {return;}- if (!this.props.isAnimationDraggerDragging && !this.props.moved && (this.state.mouseDown || e.type === 'touchend')) {+ if (!this.props.isAnimationDraggerDragging &&+ !this.props.moved &&+ (this.state.mouseDown || e.type === 'touchend')) {let {currentTimeRange} = this.state;@@ -622,7 +709,7 @@ class TimelineAxis extends Component {setLineTimeTouch = (e) => {e.preventDefault();e.stopPropagation();- if (e.target.className.animVal !== 'grid') {+ if (e.target.className.animVal !== 'axis-grid-rect') {return;}if (!this.props.isAnimationDraggerDragging && !this.props.moved) {@@ -698,9 +785,21 @@ class TimelineAxis extends Component {* @returns {void}*/handleStartDrag = (e, d) => {- // this.setState({- // isTimelineDragging: true- // });+ let updatePositioningArguments = {+ moved: this.props.moved,+ isTimelineDragging: true,+ position: this.props.position,+ transformX: this.props.transformX,+ frontDate: this.props.frontDate,+ backDate: this.props.backDate,+ draggerPosition: this.props.draggerPosition,+ draggerPositionB: this.props.draggerPositionB,+ draggerVisible: this.props.draggerVisible,+ draggerVisibleB: this.props.draggerVisibleB,+ animationStartLocation: this.props.animationStartLocation,+ animationEndLocation: this.props.animationEndLocation+ };+ this.props.updatePositioning(updatePositioningArguments);}/**@@ -709,9 +808,11 @@ class TimelineAxis extends Component {* @param {Object} draggable delta object* @returns {void}*/- handleDrag = (e, d) => {+ handleDrag(e, d) {e.stopPropagation();- e.preventDefault();+ if (e.type !== 'wheel') {+ e.preventDefault();+ }let {gridWidth,dragSentinelChangeNumber,@@ -750,9 +851,6 @@ class TimelineAxis extends Component {animationStartLocation,animationEndLocation};- // this.setState({- // dragSentinelCount: dragSentinelCount + deltaX- // }, this.props.updatePositioning(updatePositioningArguments));this.setState({dragSentinelCount: dragSentinelCount + deltaX});@@ -798,10 +896,6 @@ class TimelineAxis extends Component {animationStartLocation,animationEndLocation};- // this.setState({- // currentTimeRange,- // dragSentinelCount: newDragSentinelCount- // }, this.props.updatePositioning(updatePositioningArguments));this.setState({currentTimeRange,dragSentinelCount: newDragSentinelCount@@ -826,10 +920,6 @@ class TimelineAxis extends Component {animationStartLocation,animationEndLocation};-- // this.setState({- // dragSentinelCount: newDragSentinelCount- // }, this.props.updatePositioning(updatePositioningArguments));this.setState({dragSentinelCount: newDragSentinelCount});@@ -875,10 +965,6 @@ class TimelineAxis extends Component {animationStartLocation,animationEndLocation};- // this.setState({- // currentTimeRange,- // dragSentinelCount: newDragSentinelCount- // }, this.props.updatePositioning(updatePositioningArguments));this.setState({currentTimeRange,dragSentinelCount: newDragSentinelCount@@ -903,9 +989,6 @@ class TimelineAxis extends Component {animationStartLocation,animationEndLocation};- // this.setState({- // dragSentinelCount: newDragSentinelCount- // }, this.props.updatePositioning(updatePositioningArguments));this.setState({dragSentinelCount: newDragSentinelCount});@@ -916,7 +999,8 @@ class TimelineAxis extends Component {}/**- * @desc handle stop drag of axis. moved === false means an axis click+ * @desc handle stop drag of axis.+ * d.x === midpoint means an axis click and moved is false* @param {Event} mouse event* @param {Object} draggable delta object* @returns {void}@@ -947,7 +1031,6 @@ class TimelineAxis extends Component {leftBound = -midPoint * 2;rightBound = midPoint * 2;}-transformX = transformX + position;let updatePositioningArguments = {moved,@@ -963,15 +1046,13 @@ class TimelineAxis extends Component {animationStartLocation: this.props.animationStartLocation,animationEndLocation: this.props.animationEndLocation};- // this.setState({- // leftBound,- // rightBound- // }, this.props.updatePositioning(updatePositioningArguments));this.setState({leftBound,rightBound});- this.props.updatePositioning(updatePositioningArguments);+ // hoverTime conditional reset necessary for touchpad horizontal scroll gesture+ let hoverTime = moved ? null : this.props.hoverTime;+ this.props.updatePositioning(updatePositioningArguments, hoverTime);}shouldComponentUpdate(nextProps, nextState) {@@ -989,10 +1070,14 @@ class TimelineAxis extends Component {timelineEndDateLimit,transformX,frontDate,- backDate+ backDate,+ // animStartLocationDate,+ // animEndLocationDate} = this.props;let checkForPropsUpdates = (+ // nextProps.animStartLocationDate === animStartLocationDate &&+ // nextProps.animEndLocationDate === animEndLocationDate &&nextProps.axisWidth === axisWidth &&nextProps.dateA === dateA &&nextProps.dateB === dateB &&@@ -1058,7 +1143,7 @@ class TimelineAxis extends Component {style={{ width: `${axisWidth}px` }}onMouseDown={this.handleMouseDown}onMouseUp={this.setLineTime}- onWheel={this.wheelZoom}+ onWheel={this.handleWheel}onMouseOver={this.showHoverOn}onMouseLeave={this.props.showHoverOff}onTouchStart={this.handleMouseDown}@@ -1083,12 +1168,11 @@ class TimelineAxis extends Component {</defs><Draggableaxis='x'- onDrag={this.handleDrag}+ handle=".axis-grid-container"position={{ x: position, y: 0 }}+ onDrag={this.handleDrag}onStart={this.handleStartDrag}onStop={this.handleStopDrag}- // onTouchStart={this.handleStartDrag}- // onTouchEnd={this.handleStopDrag}bounds={{ left: leftBound, top: 0, bottom: 0, right: rightBound }}><g>@@ -1117,14 +1201,13 @@ TimelineAxis.propTypes = {compareModeActive: PropTypes.bool,draggerSelected: PropTypes.string,hasSubdailyLayers: PropTypes.bool,- // parentOffset: PropTypes.number,+ parentOffset: PropTypes.number,dateA: PropTypes.string,dateB: PropTypes.string,startDate: PropTypes.string,timeScale: PropTypes.string,timelineEndDateLimit: PropTypes.string,- timelineStartDateLimit: PropTypes.string,- // updateAnimationRange: PropTypes.func+ timelineStartDateLimit: PropTypes.string};export default TimelineAxis;diff --git a/web/js/components/timeline/timeline-axis/timeline-dragger.js b/web/js/components/timeline/timeline-axis/timeline-dragger.jsindex 1bd78280c..c26750431 100644--- a/web/js/components/timeline/timeline-axis/timeline-dragger.js+++ b/web/js/components/timeline/timeline-axis/timeline-dragger.js@@ -77,7 +77,7 @@ class Dragger extends PureComponent {cursor: 'pointer',display: draggerVisible ? 'block' : 'none'}}- className='gridShell dragger'+ className='timeline-dragger dragger'transform={`translate(${transformX}, 0)`}><polygondiff --git a/web/js/components/timeline/timeline.css b/web/js/components/timeline/timeline.cssindex 496616c64..759399ac4 100644--- a/web/js/components/timeline/timeline.css+++ b/web/js/components/timeline/timeline.css@@ -1,16 +1,6 @@@import url('https://fonts.googleapis.com/css?family=Roboto+Mono:500');-html, body {- overflow-x: hidden;- font-family: Arial, Helvetica, sans-serif;-}--#timelineContainer {- position: absolute;- bottom: -24px;-}-.timeline-axis-container {height: 65px;border-top: 1.5px solid white;@@ -25,7 +15,7 @@ html, body {clip-path: url('#timelineBoundary'); */}-.dateToolTip {+.date-tooltip {background: #212121;color: #fff;border: thin solid #666;@@ -40,25 +30,26 @@ html, body {padding-left: 8px;}-.dateToolTip-dayOfYear {+.date-tooltip-day {font-size: 14px;display: inline-block;vertical-align: top;}-.gridShell {+.axis-grid-container,+.timeline-dragger {display: flex;flex-direction: row;align-items: center;}-.grid {+.axis-grid-rect {color: white;font-size: 12px;height: 63px;}-.gridText {+.axis-grid-text {font-size: 18px;font-weight: 500;font-family: 'Roboto Mono', monospace;@@ -67,16 +58,12 @@ html, body {user-select: none;}-line {+.axis-grid-line {pointer-events: none;}/* DEVELOPMENT */-#timelineContainer > div:nth-child(1) > div.wv-date-selector-widget {- background: #999;-}-#zoom-btn-container-axis {margin-bottom: 5px;}diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.jsindex ffc5232a7..3a59df057 100644--- a/web/js/containers/timeline/timeline.js+++ b/web/js/containers/timeline/timeline.js@@ -229,7 +229,7 @@ class Timeline extends React.Component {draggerVisibleB,animationStartLocation,animationEndLocation- }) => {+ }, hoverTime = this.state.hoverTime) => {this.setState({moved,isTimelineDragging,@@ -243,7 +243,8 @@ class Timeline extends React.Component {draggerVisible,draggerVisibleB,animationStartLocation,- animationEndLocation+ animationEndLocation,+ hoverTime: hoverTime});}<<<<<<< HEAD@@ -469,6 +470,7 @@ class Timeline extends React.Component {let frontDate = moment.utc(this.state.frontDate);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,@@ -534,11 +536,40 @@ class Timeline extends React.Component {let prevStartLocationDate = prevProps.animStartLocationDate;let prevEndLocationDate = prevProps.animEndLocationDate;- let { animStartLocationDate, animEndLocationDate, dateA, dateB, isAnimationWidgetOpen, customSelected, customIntervalValue, customIntervalZoomLevel } = this.props;+ let {+ animStartLocationDate,+ animEndLocationDate,+ dateA,+ dateB,+ isAnimationWidgetOpen,+ customSelected,+ customIntervalValue,+ customIntervalZoomLevel+ } = this.props;+// handle location update triggered from animation start/end date change from animation widget- if (prevStartLocationDate && prevEndLocationDate) {- if (prevStartLocationDate !== animStartLocationDate || prevEndLocationDate !== animEndLocationDate) {- this.animationDraggerDateUpdate(animStartLocationDate, animEndLocationDate);+ if (isAnimationWidgetOpen) {+ if (prevStartLocationDate && prevEndLocationDate) {+ if (prevStartLocationDate.getTime() !== animStartLocationDate.getTime() ||+ prevEndLocationDate.getTime() !== animEndLocationDate.getTime() ||+ prevState.frontDate !== this.state.frontDate) {+ this.animationDraggerDateUpdate(animStartLocationDate, animEndLocationDate);+ }+ }++ // handle open/close custom interval panel if 'custom' selected in animation widget+ // and no custom value has been initialized+ if (customIntervalValue === 1 && customIntervalZoomLevel === 3) {+ if (!prevProps.customSelected && customSelected) {+ this.setState({+ customIntervalModalOpen: true+ });+ }+ if (prevProps.customSelected && !customSelected) {+ this.setState({+ customIntervalModalOpen: false+ });+ }}}@@ -553,27 +584,6 @@ class Timeline extends React.Component {draggerTimeStateB: dateB});}-- // handle open/close custom interval panel if 'custom' selected in animation widget- // and no custom value has been initialized- if (isAnimationWidgetOpen &&- !prevProps.customSelected &&- customSelected &&- customIntervalValue === 1 &&- customIntervalZoomLevel === 3) {- this.setState({- customIntervalModalOpen: true- });- }- if (isAnimationWidgetOpen &&- prevProps.customSelected &&- !customSelected &&- customIntervalValue === 1 &&- customIntervalZoomLevel === 3) {- this.setState({- customIntervalModalOpen: false- });- }}componentDidMount() {