Interactive interface for browsing global, full-resolution satellite imagery
start refactor and pull in animation range select and draggers into timeline axis - work in progress, optimize grid range components, style fixes for custom interval selector
Edward Plato14820ea8c0a0
diff --git a/web/js/animation/range-select.js b/web/js/animation/range-select.jsindex f0cc9470a..332816afe 100644--- a/web/js/animation/range-select.js+++ b/web/js/animation/range-select.js@@ -93,8 +93,10 @@ export function animationRangeSelect(models, config, ui) {}options = {- startLocation: startLocation, // or zero- endLocation: endLocation,+ // startLocation: startLocation, // or zero+ // endLocation: endLocation,+ startLocation: -250, // or zero+ endLocation: -260,startLocationDate: model.rangeState.startDate,endLocationDate: model.rangeState.endDate,timelineStartDateLimit: timelineStartDateLimit,@@ -147,7 +149,7 @@ export function animationRangeSelect(models, config, ui) {*/self.getLocationFromStringDate = function(date) {// return timeline.x(util.roundTimeTenMinute(date));- return -100;+ return -200;};/*diff --git a/web/js/app.js b/web/js/app.jsindex 9683860cb..cf3602b85 100644--- a/web/js/app.js+++ b/web/js/app.js@@ -405,6 +405,8 @@ class App extends React.Component {ui.dateWheels = dateWheels(models, config);}+ console.log(ui)+ui.rubberband = imageRubberband(models, ui, config);ui.image = imagePanel(models, ui, config);if (config.features.dataDownload) {diff --git a/web/js/components/range-selection/dragger-range.js b/web/js/components/range-selection/dragger-range.jsindex 747030119..66bb09cc8 100644--- a/web/js/components/range-selection/dragger-range.js+++ b/web/js/components/range-selection/dragger-range.js@@ -215,7 +215,7 @@ class TimelineDraggerRange extends React.Component {handle=".dragger-range"axis="x"position={null}- defaultPosition={{ x: 0, y: -16 }}+ defaultPosition={{ x: 0, y: 0 }}onStop={this.props.onStop}onDrag={this.handleDrag.bind(this)}>diff --git a/web/js/components/range-selection/dragger.js b/web/js/components/range-selection/dragger.jsindex cae0c45ab..f333fb196 100644--- a/web/js/components/range-selection/dragger.js+++ b/web/js/components/range-selection/dragger.js@@ -190,7 +190,7 @@ TimelineDragger.defaultProps = {color: '#fff',position: 0,visibility: 'visible',- yOffset: -16,+ yOffset: 23,path: null,textColor: '#000'};diff --git a/web/js/components/timeline/interval-selector/interval-selector.js b/web/js/components/timeline/interval-selector/interval-selector.jsindex 34c2c4e91..6b65728c9 100644--- a/web/js/components/timeline/interval-selector/interval-selector.js+++ b/web/js/components/timeline/interval-selector/interval-selector.js@@ -70,7 +70,7 @@ class CustomIntervalSelectorWidget extends React.Component {// }onKeyDown={this.handleKeyPress}className='wv-animation-widget-custom-interval'- style={{display: this.props.customIntervalModalOpen ? 'block' : 'none', height: '110px'}}+ style={{display: this.props.customIntervalModalOpen ? 'block' : 'none'}}><div>Custom Interval Selector</div>diff --git a/web/js/components/timeline/timeline-axis/date-calc.js b/web/js/components/timeline/timeline-axis/date-calc.jsindex 265a1f61b..8a0484c51 100644--- a/web/js/components/timeline/timeline-axis/date-calc.js+++ b/web/js/components/timeline/timeline-axis/date-calc.js@@ -42,11 +42,15 @@ const timeScaleOptions = {};export default (function (self) {- self.getTimeRange = (startDate, endDate, timeScale) => {+ self.getTimeRange = (startDate, endDate, timeScale, timelineStartDateLimit, timelineEndDateLimit) => {// const startTime = performance.now();let dates = [];let { format } = timeScaleOptions[timeScale].timeAxis;- let currentDate = moment.utc(new Date()).add(1, timeScale);+ // let currentDate = moment.utc(new Date()).add(1, timeScale);+ let startDateLimit = moment.utc(timelineStartDateLimit);+ let endDateLimit = moment.utc(timelineEndDateLimit);++ console.log(timelineStartDateLimit, timelineEndDateLimit)// endDate = endDate.isAfter(currentDate) ? currentDate : endDate;// console.log(endDate.format(), currentDate.format)@@ -57,7 +61,7 @@ export default (function (self) {let rawNextDate = nextDate.format();// # EXPENSIVE IN BETWEEN FOR LARGE NUMBERS - removing cuts function time down some, but may be neglible - main focus is smaller total request size- let withinRange = startDate.isBetween(pastDateLimit, currentDate.format(), null, '[]');+ let withinRange = startDate.isBetween(startDateLimit, endDateLimit, null, '[]');let timeObject = {dateObject: startDate.toObject(),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 94f697b96..fb08cfc06 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@@ -50,7 +50,7 @@ class GridRange extends PureComponent {showHover={this.showHover}/><line className="svgLine" style={{display: this.props.showHoverLine ? 'block' : 'none'}}- stroke="blue" strokeWidth="2" strokeOpacity="0.48" x1="0" x2="0" y1="0" y2="90"+ stroke="blue" strokeWidth="2" strokeOpacity="0.48" x1="0" x2="0" y1="0" y2="74"transform={`translate(${this.state.hoverLinePosition + 1}, 0)`} shapeRendering="optimizeSpeed"/></g>)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 51f0f7f29..16a20718a 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@@ -7,11 +7,12 @@ const axisScaleGridElement = {timeScaleUnit === 15 ||timeScaleUnit === 30 ||timeScaleUnit === 45 ? 58 : timeScaleUnit % 5 === 0 ? 20 : 10;+ let whiteLineStrokeWidth = lineLengthY !== 10 ? 2 : 1;return (<React.Fragment><rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect><line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />- <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />+ <line stroke="white" strokeLinecap="round" strokeWidth={whiteLineStrokeWidth} x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} /></React.Fragment>)},@@ -21,44 +22,48 @@ const axisScaleGridElement = {timeScaleUnit === 6 ||timeScaleUnit === 12 ||timeScaleUnit === 18 ? 22 : 10;+ let whiteLineStrokeWidth = lineLengthY !== 10 ? 2 : 1;return (<React.Fragment><rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect><line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />- <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />+ <line stroke="white" strokeLinecap="round" strokeWidth={whiteLineStrokeWidth} x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} /></React.Fragment>)},day: (gridWidth, index, item) => {let dayOfWeek = item.dayOfWeek;let lineLengthY = item.dateObject.date === 1 ? 58 : dayOfWeek === 0 ? 22 : 10;+ let whiteLineStrokeWidth = lineLengthY !== 10 ? 2 : 1;return (<React.Fragment><rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect><line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />- <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />+ <line stroke="white" strokeLinecap="round" strokeWidth={whiteLineStrokeWidth} x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} /></React.Fragment>)},month: (gridWidth, index, item) => {let timeScaleUnit = item.dateObject.months;let lineLengthY = timeScaleUnit === 0 ? 58 : timeScaleUnit % 3 === 0 ? 22 : 10;+ let whiteLineStrokeWidth = lineLengthY !== 10 ? 2 : 1;return (<React.Fragment><rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect><line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />- <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />+ <line stroke="white" strokeLinecap="round" strokeWidth={whiteLineStrokeWidth} x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} /></React.Fragment>)},year: (gridWidth, index, item) => {let timeScaleUnit = item.dateObject.years;let lineLengthY = timeScaleUnit % 10 === 0 ? 58 : timeScaleUnit % 5 === 0 ? 22 : 10;+ let whiteLineStrokeWidth = lineLengthY !== 10 ? 2 : 1;return (<React.Fragment><rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect><line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />- <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />+ <line stroke="white" strokeLinecap="round" strokeWidth={whiteLineStrokeWidth} x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} /></React.Fragment>)},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 22f9ff1fd..4d8f2aba1 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,78 +1,89 @@import React, { PureComponent } from 'react';-const axisScaleTextElement = {- minute: (gridWidth, index, item) => {- return (- <React.Fragment>- <g>- <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>- </g>- </React.Fragment>- )- },- hour: (gridWidth, index, item) => {- let timeScaleUnit = item.dateObject.hours;- let dateText = timeScaleUnit === 12 || timeScaleUnit === 6 || timeScaleUnit === 18 ? `${timeScaleUnit}:00` : item.date;- return (- <React.Fragment>- <g>- <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{dateText}</text>- </g>- </React.Fragment>- )- },- day: (gridWidth, index, item) => {- // let timeScaleUnit = item.dateObject.date;- return (- <React.Fragment>- <g>- <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>- </g>- </React.Fragment>- )- },- month: (gridWidth, index, item) => {- // let timeScaleUnit = item.dateObject.months;- return (- <React.Fragment>- <g>- <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 5}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>- </g>- </React.Fragment>- )- },- year: (gridWidth, index, item) => {- // let timeScaleUnit = item.dateObject.years;- return (- <React.Fragment>- <g>- <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 5}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>- </g>- </React.Fragment>- )- },-}+// const axisScaleTextElement = {+// minute: (gridWidth, index, item) => {+// return (+// <React.Fragment>+// <g>+// <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>+// </g>+// </React.Fragment>+// )+// },+// hour: (gridWidth, index, item) => {+// let timeScaleUnit = item.dateObject.hours;+// let dateText = timeScaleUnit === 12 || timeScaleUnit === 6 || timeScaleUnit === 18 ? `${timeScaleUnit}:00` : item.date;+// return (+// <React.Fragment>+// <g>+// <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{dateText}</text>+// </g>+// </React.Fragment>+// )+// },+// day: (gridWidth, index, item) => {+// return (+// <React.Fragment>+// <g>+// <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>+// </g>+// </React.Fragment>+// )+// },+// month: (gridWidth, index, item) => {+// return (+// <React.Fragment>+// <g>+// <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 5}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>+// </g>+// </React.Fragment>+// )+// },+// year: (gridWidth, index, item) => {+// return (+// <React.Fragment>+// <g>+// <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 5}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>+// </g>+// </React.Fragment>+// )+// },+// }+// class TileText extends PureComponent {+// //# TODO: all of these (if visible or not) are being updated - should optimize so only visible are shown+// render() {+// let { item, gridWidth, index } = this.props;+// return (+// axisScaleTextElement[item.timeScale](gridWidth, index, item)+// )+// }+// }-class TileText extends PureComponent {- //# TODO: all of these (if visible or not) are being updated - should optimize so only visible are shown- // componentDidUpdate() {- // console.log('TileText update')- // }- render() {- let { item, gridWidth, index } = this.props;- // console.log(item)- return (- axisScaleTextElement[item.timeScale](gridWidth, index, item)- )+// FUNCTIONAL COMPONENT VERSION OF ABOVE - less code in compile+const axisScaleTextElementWrapper = (gridWidth, index, item) => {+ let dateText = item.date;+ if (item.timeScale === 'hour') {+ let timeScaleUnit = item.dateObject.hours;+ dateText = timeScaleUnit === 12 || timeScaleUnit === 6 || timeScaleUnit === 18 ? `${timeScaleUnit}:00` : item.date;+ }+ let xOffsetAdded = 8;+ if (item.timeScale === 'month' || item.timeScale === 'year') {+ xOffsetAdded = 5;}-}+ return (+ <React.Fragment>+ <g>+ <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + xOffsetAdded}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{dateText}</text>+ </g>+ </React.Fragment>+ );+};-// FUNCTIONAL COMPONENT VERSION OF ABOVE - less code in compile-// const TileText = ({ item, gridWidth, index }) => {-// return (-// axisScaleTextElement[item.timeScale](gridWidth, index, item)-// )-// }+const TileText = ({ item, gridWidth, index }) => {+ return (+ axisScaleTextElementWrapper(gridWidth, index, item)+ );+};-export default TileText;\ No newline at end of file+export default TileText;diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.jsindex af1ee385e..9c1d49e0e 100644--- a/web/js/components/timeline/timeline-axis/timeline-axis.js+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js@@ -8,6 +8,7 @@ import GridRange from './grid-range/grid-range';import Dragger from './timeline-dragger';import dateCalc from './date-calc';+import TimelineRangeSelector from '../../range-selection/range-selection';const draggerWidth = 49;const timeScales = [ 'year', 'month', 'day', 'hour', 'minute' ];@@ -73,8 +74,8 @@ class TimelineAxis extends React.Component {currentDateRange: null,currentTransformX: 0,gridWidth: 100,- pastDateLimit: '1940-01-01T00:00:00.000',- futureDateLimit: '2020-01-01T00:00:00.000',+ animationStartLocation: 0,+ animationEndLocation: 0}}//? how do position and transforms change between scale changes? lock into one line would be ideal@@ -85,7 +86,7 @@ class TimelineAxis extends React.Component {let gridWidth = options.gridWidth;let axisWidth = axisWidthInput ? axisWidthInput : this.props.axisWidth;let leftOffset = leftOffsetFixedCoeff ? axisWidth * leftOffsetFixedCoeff : this.state.leftOffset;-debugger;+// debugger;if (leftOffset === 0) {leftOffset = axisWidth / 2;}@@ -110,7 +111,7 @@ console.log(leftOffset,axisWidth)hoverTime = inputDate ? moment.utc(inputDate) : hoverTime;let hoverTimeZero = hoverTime.clone().startOf(timeScale);if (timeScale === 'year') {- hoverTimeZero = moment.utc(this.state.pastDateLimit);+ hoverTimeZero = moment.utc(this.props.timelineStartDateLimit);}let hoverTimeNextZero = hoverTimeZero.clone().add(1, timeScale);@@ -186,6 +187,22 @@ console.log(leftOffset,axisWidth)position = 0 + axisWidth / 2 + (leftOffset - axisWidth / 2);}+ // update animation draggers+ let animationStartLocationDate;+ let animationStartDraggerLocation;+ let animationEndLocationDate;+ let animationEndDraggerLocation;++ if (true || this.props.startLocationDate) {+ // animationStartLocationDate = moment.utc(this.props.startLocationDate);+ animationStartLocationDate = this.state.animationStartLocationDate;+ animationStartDraggerLocation = Math.abs(frontDate.diff(animationStartLocationDate, timeScale, true) * gridWidth);++ // animationEndLocationDate = moment.utc(this.props.endLocationDate);+ animationEndLocationDate = this.state.animationEndLocationDate;+ animationEndDraggerLocation = Math.abs(frontDate.diff(animationEndLocationDate, timeScale, true) * gridWidth);+ }+let currentTransformX = 0;// console.log(midPoint, position, pixelsToAdd, leftOffset);this.setState({@@ -209,7 +226,11 @@ console.log(leftOffset,axisWidth)position: position,midPoint: position,dragSentinelCount: 0,- showHoverLine: false+ showHoverLine: false,+ animationStartLocation: animationStartDraggerLocation + position -pixelsToAdd - 2,+ animationEndLocation: animationEndDraggerLocation + position -pixelsToAdd - 2,+ animationStartLocationDate: animationStartLocationDate,+ animationEndLocationDate: animationEndLocationDate})}@@ -249,7 +270,9 @@ console.log(leftOffset,axisWidth)draggerPosition: draggerPosition,draggerPositionB: draggerPositionB,position: position,- dragSentinelCount: dragSentinelCount + deltaX+ dragSentinelCount: dragSentinelCount + deltaX,+ animationStartLocation: this.state.animationStartLocation + deltaX,+ animationEndLocation: this.state.animationEndLocation + deltaX});} else {if (deltaX > 0) { // # dragging right - exposing past dates@@ -278,7 +301,9 @@ console.log(leftOffset,axisWidth)draggerPositionB: draggerPositionRevisionB,draggerVisibleB: draggerVisibleB,position: position,- showHoverLine: false+ showHoverLine: false,+ animationStartLocation: this.state.animationStartLocation + deltaX,+ animationEndLocation: this.state.animationEndLocation + deltaX}));} else {// reset dragSentinelCount on direction change to remaining distance to dragSentinelChangeNumber@@ -288,7 +313,9 @@ console.log(leftOffset,axisWidth)draggerPositionB: draggerPositionB,position: position,dragSentinelCount: newDragSentinelCount,- showHoverLine: false+ showHoverLine: false,+ animationStartLocation: this.state.animationStartLocation + deltaX,+ animationEndLocation: this.state.animationEndLocation + deltaX}));}} else if (deltaX < 0) { // # dragging left - exposing future dates@@ -317,7 +344,9 @@ console.log(leftOffset,axisWidth)draggerPositionB: draggerPositionRevisionB,draggerVisibleB: draggerVisibleB,position: position,- showHoverLine: false+ showHoverLine: false,+ animationStartLocation: this.state.animationStartLocation + deltaX,+ animationEndLocation: this.state.animationEndLocation + deltaX}));} else {// reset dragSentinelCount on direction change to remaining distance to dragSentinelChangeNumber@@ -327,7 +356,9 @@ console.log(leftOffset,axisWidth)draggerPositionB: draggerPositionB,position: position,dragSentinelCount: newDragSentinelCount,- showHoverLine: false+ showHoverLine: false,+ animationStartLocation: this.state.animationStartLocation + deltaX,+ animationEndLocation: this.state.animationEndLocation + deltaX}));}}@@ -396,7 +427,8 @@ console.log(leftOffset,axisWidth)} else {draggerVisibleB = false;}- } else { // check individual draggers based on which is currently selected+ } else {+ // check individual draggers based on which is currently selectedif (draggerSelected === 'selected') { // dragger A selectedlet isBetween = moment.utc(this.state.draggerTimeState).isBetween(frontDate, backDate, null, '[]');if (isBetween) { // A dragger@@ -471,7 +503,12 @@ console.log(leftOffset,axisWidth)startDate = dayZeroed.clone().subtract(subtract, timeScale);endDate = dayZeroed.clone().add(add, timeScale);}- dateArray = dateCalc.getTimeRange(startDate, endDate, timeScale);+ dateArray = dateCalc.getTimeRange(+ startDate,+ endDate,+ timeScale,+ this.props.timelineStartDateLimit,+ this.props.timelineEndDateLimit);return dateArray;}@@ -586,6 +623,22 @@ console.log(leftOffset,axisWidth)let draggerPosition = Math.abs(frontDate.diff(draggerTime, timeScale, true) * gridWidth);let draggerPositionB = Math.abs(frontDate.diff(moment.utc(draggerTimeStateB), timeScale, true) * gridWidth);+ // animation dragger positioning+ let animationStartLocationDate;+ let animationStartDraggerLocation;+ let animationEndLocationDate;+ let animationEndDraggerLocation;++ if (true || this.props.startLocationDate) {+ // animationStartLocationDate = moment.utc(this.props.startLocationDate);+ animationStartLocationDate = '2019-04-26T18:00:00Z';+ animationStartDraggerLocation = Math.abs(frontDate.diff(animationStartLocationDate, timeScale, true) * gridWidth);++ // animationEndLocationDate = moment.utc(this.props.endLocationDate);+ animationEndLocationDate = '2019-05-02T00:00:00Z';+ animationEndDraggerLocation = Math.abs(frontDate.diff(animationEndLocationDate, timeScale, true) * gridWidth);+ }+this.setState({deque: new Deque(current.dates),draggerPosition: draggerPosition + midPoint - draggerWidth,@@ -602,6 +655,10 @@ console.log(leftOffset,axisWidth)currentTransformX: 0,midPoint: midPoint,position: midPoint,+ animationStartLocation: animationStartDraggerLocation + midPoint,+ animationEndLocation: animationEndDraggerLocation + midPoint,+ animationStartLocationDate: animationStartLocationDate,+ animationEndLocationDate: animationEndLocationDate})// }, function() {// this.updateScale(time, timeScale, this.props.axisWidth, 0.90)@@ -911,7 +968,6 @@ console.log(leftOffset,axisWidth)})}} else { // handle drag within axis view- debugger;if (draggerASelected) {// prevent function invoke on dragger click, but no date changeif (moment.utc(this.props.dateFormatted).format() !== newDraggerTime) {@@ -990,6 +1046,54 @@ console.log(leftOffset,axisWidth)// return 200;// }+ // handle animation dragger drag change+ animationDraggerPositionUpdate = (startLocation, endLocation) => {+ let timeScale = this.props.timeScale;+ let gridWidth = this.state.gridWidth;+ // calculate new start and end positions+ let deltaXStart = startLocation - this.state.animationStartLocation;+ let animationStartLocationDate = this.state.animationStartLocationDate;+ let deltaXEnd = endLocation - this.state.animationEndLocation;+ let animationEndLocationDate = this.state.animationEndLocationDate;++ if (deltaXStart !== 0 || deltaXEnd !== 0) {+ let diffZeroValues = timeScaleOptions[timeScale].timeAxis.scaleMs;+ // get startDate for diff calculation+ let draggerTimeStart = moment.utc(this.state.animationStartLocationDate);+ // only need to calculate difference in time unit for varying timescales - month and year+ if (!diffZeroValues) {+ let draggerTimeStartZero = draggerTimeStart.clone().startOf(timeScale);+ let draggerTimeStartNextZero = draggerTimeStartZero.clone().add(1, timeScale);++ let draggerTimeStartZeroValue = draggerTimeStartZero.valueOf();+ let draggerTimeStartNextZeroValue = draggerTimeStartNextZero.valueOf();++ diffZeroValues = draggerTimeStartNextZeroValue - draggerTimeStartZeroValue;+ }+ let diffFactor = diffZeroValues / gridWidth;++ if (deltaXStart !== 0) { // update new start date+ // let draggerTimeStart = moment.utc(this.state.animationStartLocationDate);+ let draggerTimeStartValue = draggerTimeStart.valueOf();+ animationStartLocationDate = moment.utc(draggerTimeStartValue + (diffFactor * deltaXStart)).format();+ }++ if (deltaXEnd !== 0) { // update new end date+ let draggerTimeEnd = moment.utc(this.state.animationEndLocationDate);+ let draggerTimeEndValue = draggerTimeEnd.valueOf();+ animationEndLocationDate = moment.utc(draggerTimeEndValue + (diffFactor * deltaXEnd)).format();+ }+ }++ // need props function to handle state update?!+ this.setState({+ animationStartLocation: startLocation,+ animationEndLocation: endLocation,+ animationStartLocationDate: animationStartLocationDate,+ animationEndLocationDate: animationEndLocationDate+ })+ }+render() {return (<React.Fragment>@@ -1006,11 +1110,17 @@ console.log(leftOffset,axisWidth)width={this.props.axisWidth}height={70}viewBox={`0 0 ${this.props.axisWidth} 75`}+ // style={{clipPath: 'url(#tester)'}} clipPath="url(#tester)"preserveAspectRatio="none"><defs>+ {/* clip axis grid text */}<clipPath id="textDisplay"><rect width="200" height="70" /></clipPath>+ {/* clip axis grid overflow */}+ <clipPath id="timelineBoundary">+ <rect width={this.props.axisWidth} height={70}></rect>+ </clipPath></defs><g id="wv-rangeselector-case"></g><Draggable@@ -1031,6 +1141,30 @@ console.log(leftOffset,axisWidth)transformX={this.state.currentTransformX} /></g></Draggable>++ {/* //? INSERT RANGE SELECTION HERE */}+ <TimelineRangeSelector+ startLocation={this.state.animationStartLocation}+ endLocation={this.state.animationEndLocation}+ // startLocationDate={"2019-03-01T00:00:00Z"}+ // endLocationDate={"2019-04-01T00:00:00Z"}+ startLocationDate={this.state.animationStartLocationDate}+ endLocationDate={this.state.animationEndLocationDate}+ timelineStartDateLimit={this.props.timelineStartDateLimit}+ timelineEndDateLimit={this.props.timelineEndDateLimit}+ max={{end: false, start: false, startOffset: -50, width: 1000}}+ pinWidth={5}+ height={45}+ // onDrag={(sx, ex) => console.log('onDrag', sx, ex)}+ onDrag={this.animationDraggerPositionUpdate.bind(this)}+ onRangeClick={() => console.log('onRangeClick')}+ rangeOpacity={0.3}+ rangeColor={"#45bdff"}+ startColor={"#40a9db"}+ startTriangleColor={"#fff"}+ endColor={"#295f92"}+ endTriangleColor={"#4b7aab"} />+{this.props.draggerSelected === 'selectedB' ?<React.Fragment><Draggerdiff --git a/web/js/components/timeline/timeline.css b/web/js/components/timeline/timeline.cssindex f34b9fefe..575f16879 100644--- a/web/js/components/timeline/timeline.css+++ b/web/js/components/timeline/timeline.css@@ -8,27 +8,12 @@ html, body {}#timelineContainer {- /* margin-top: 200px;- background: yellow; */position: absolute;- /* top: 200px; */bottom: -24px;- /* left: 416px; */}#wv-timeline-axis {- /* margin: 0 20px 0 0; */- /* margin-left: 25%; */- /* width: 800px; */- height: 100px;- /* position: absolute;-- right: 50px; */- /* border: 1px solid black; */- /* background-image: url('mock-wv-background.jpg');- background-repeat: repeat-x;- background-size: 3000px 72px; */- /* overflow: hidden; */+ height: 60px;}.inner {@@ -38,6 +23,8 @@ html, body {flex-direction: row;align-items: center;border-top: 1.5px solid white;+ /* -webkit-clip-path: url('#timelineBoundary');+ clip-path: url('#timelineBoundary'); */}.dateToolTip {@@ -56,7 +43,9 @@ html, body {display: flex;flex-direction: row;align-items: center;- position: 100px;+ /* -webkit-clip-path: url('#timelineBoundary');+ clip-path: url('#timelineBoundary'); */+ /* position: 100px; */}.grid {@@ -84,7 +73,7 @@ line {.line {top: 102px;width: 2px;- height: 70px;+ height: 60px;background: rgba(21,21,255,0.4);position: absolute;pointer-events: none;@@ -186,11 +175,11 @@ form select {}.interval-timescale-select {- width: 70px;+ width: 100px;height: 40px;color: #7890cd;opacity: 1;- font-size: 24px;+ font-size: 20px;background: transparent;border: 0;font-family: 'Roboto Mono', monospace;@@ -208,13 +197,13 @@ form select {background: #212121;color: #7890cd;height: 40px;- width: 130px;+ width: 118px;border: thin solid #fff;margin-top: 1px;}.custom-interval-buttons {- margin-right: 15px;+ margin-right: 8px;}.custom-interval-text {@@ -263,21 +252,21 @@ form select {}.date-arrow-wrapper {- width: 80px;+ width: 60px;}.wv-animation-widget-custom-interval {- width: 330px;- border-radius: 8px;- height: 125px;+ height: 110px;+ width: 286px;+ border-top-left-radius: 8px;+ border-top-right-radius: 8px;background: #212121;position: absolute;- transform: translateX(-50%);- -webkit-transform: translate(-50%);- top: -160px;- /* left: -93px; */+ top: -113px;+ left: -153px;display: none;color: #fff;+ border-bottom: 2px solid #444;}.wv-animation-widget-custom-interval i.wv-close {@@ -327,3 +316,6 @@ form select {margin-left: 500px;} */+/* #timeline-footer svg {+ overflow: visible !important;+} */\ No newline at end of filediff --git a/web/js/components/timeline/timeline.js b/web/js/components/timeline/timeline.jsindex 829e3336e..965b39e28 100644--- a/web/js/components/timeline/timeline.js+++ b/web/js/components/timeline/timeline.js@@ -43,7 +43,9 @@ class Timeline extends React.Component {hasSubdailyLayers: '',customIntervalModalOpen: false,timelineHidden: false,- parentOffset: ''+ parentOffset: '',+ timelineStartDateLimit: '',+ timelineEndDateLimit: ''};}@@ -124,7 +126,9 @@ class Timeline extends React.Component {intervalText: this.props.timeScale,compareModeActive: this.props.compareModeActive,customSelected: this.props.customSelected,- parentOffset: this.props.parentOffset+ parentOffset: this.props.parentOffset,+ timelineStartDateLimit: this.props.timelineStartDateLimit,+ timelineEndDateLimit: this.props.timelineEndDateLimit});}@@ -136,6 +140,7 @@ class Timeline extends React.Component {// }render() {+ console.log(this.state.selectedDate, this.state.dateFormatted)return (this.state.dateFormatted ?<React.Fragment>@@ -196,6 +201,9 @@ class Timeline extends React.Component {compareModeActive={this.state.compareModeActive}draggerSelected={this.state.draggerSelected}onChangeSelectedDragger={this.props.onChangeSelectedDragger}+ timelineStartDateLimit={this.state.timelineStartDateLimit}+ timelineEndDateLimit={this.state.timelineEndDateLimit}+ customIntervalModalOpen={this.state.customIntervalModalOpen}/></div>diff --git a/web/js/date/timeline.js b/web/js/date/timeline.jsindex e2d019f65..3b5303445 100644--- a/web/js/date/timeline.js+++ b/web/js/date/timeline.js@@ -447,9 +447,9 @@ export function timeline(models, config, ui) {};var getInitialProps = () => {- // check for compare mode+ // check for compare mode and what dragger is activelet isCompareModeActive = models.compare.active;- console.log(models.date.customSelected)+ let draggerSelected = models.date.activeDate;// if compare mode is active, check for subdaily in either A or Blet subdaily;if (isCompareModeActive) {@@ -465,22 +465,25 @@ export function timeline(models, config, ui) {}let selectedTimeScale = selectedTimeScaleState ? timeScaleFromNumberKey[selectedTimeScaleState] : 'day';+ // get selected dates, start, and end dateslet selectedDate = models.date.selected;let selectedDateB = models.date.selectedB ? models.date.selectedB : null;+ // TODO: date formatted props necessary in dev to handle model.select date rounding - remove now?+ let dateFormatted = selectedDate ? new Date(selectedDate).toISOString() : '';+ let dateFormattedB = selectedDateB ? new Date(selectedDateB).toISOString() : '';+ let timelineStartDateLimit = config.startDate;+ let timelineEndDateLimit = models.layers.lastDate().toISOString();- // custom interval+ // make custom interval, custom delta available and determine currently selected intervallet intervalTimeScale = models.date.customInterval ? timeScaleFromNumberKey[models.date.customInterval] : selectedTimeScale;let intervalDelta = models.date.customDelta ? models.date.customDelta : 1;let customSelected = models.date.customSelected ? Boolean(models.date.customSelected) : false;-let intervalSelected = models.date.interval ? timeScaleFromNumberKey[models.date.interval] : selectedTimeScale;- let draggerSelected = models.date.activeDate;+ // get separate input props+ // TODO: combined props cleaner or too long?let inputProps = getInputProps();-- let dateFormatted = selectedDate ? new Date(selectedDate).toISOString() : '';- let dateFormattedB = selectedDateB ? new Date(selectedDateB).toISOString() : '';return { ...inputProps,customIntervalZoomLevel: intervalTimeScale,compareModeActive: isCompareModeActive,@@ -492,6 +495,8 @@ export function timeline(models, config, ui) {timelineHeight: self.height,selectedDate: selectedDate,selectedDateB: selectedDateB,+ timelineStartDateLimit: timelineStartDateLimit,+ timelineEndDateLimit: timelineEndDateLimit,timeScale: selectedTimeScale,incrementDate: incrementDate,updateDate: updateDate,