Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add goes geographic layers for testing subdaily

Edward Platoa0c9309eb727
diff --git a/config/default/common/config/wv.json/layerOrder.json b/config/default/common/config/wv.json/layerOrder.json
index 47c02a032..f4c2003d6 100644
--- a/config/default/common/config/wv.json/layerOrder.json
+++ b/config/default/common/config/wv.json/layerOrder.json
@@ -868,7 +868,9 @@
"OrbitTracks_Suomi_NPP_Ascending",
"OrbitTracks_Suomi_NPP_Descending",
"OrbitTracks_Terra_Ascending",
- "OrbitTracks_Terra_Descending"
+ "OrbitTracks_Terra_Descending",
+
+ "GOES16_Air_Mass_v0_STD"
],
"layerOrderExceptions": [
"SCAR_Land_Mask",
diff --git a/config/default/common/config/wv.json/layers/goes/GOES16_Air_Mass_v0_STD.json b/config/default/common/config/wv.json/layers/goes/GOES16_Air_Mass_v0_STD.json
new file mode 100644
index 000000000..0aa4d60db
--- /dev/null
+++ b/config/default/common/config/wv.json/layers/goes/GOES16_Air_Mass_v0_STD.json
@@ -0,0 +1,16 @@
+{
+ "layers": {
+ "GOES16_Air_Mass_v0_STD": {
+ "id": "GOES16_Air_Mass_v0_STD",
+ "title": "Air Mass (RGB, GOES-16)",
+ "subtitle": "GOES",
+ "description": "goes/GOES16_Air_Mass_v0_STD",
+ "group": "baselayers",
+ "tags": "goes",
+ "layergroup": [
+ "goes"
+ ],
+ "wrapadjacentdays": true
+ }
+ }
+}
diff --git a/config/default/release/config.json b/config/default/release/config.json
index 2d47c1ce8..229af7a81 100644
--- a/config/default/release/config.json
+++ b/config/default/release/config.json
@@ -1,7 +1,7 @@
{
"wv-options-fetch": [
{
- "from": "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi?request=GetCapabilities",
+ "from": "https://uat.gibs.earthdata.nasa.gov/wmts/epsg4326/all/wmts.cgi?request=GetCapabilities",
"to": "gibs-geographic.xml"
},
{
diff --git a/config/default/release/config/wv.json/sources.json b/config/default/release/config/wv.json/sources.json
index 2f8699b9e..82ba6a8c4 100644
--- a/config/default/release/config/wv.json/sources.json
+++ b/config/default/release/config/wv.json/sources.json
@@ -7,10 +7,10 @@
"url": "https://gibs-{a-c}.earthdata.nasa.gov/wmts/epsg3031/best/wmts.cgi"
},
"GIBS:geographic": {
- "url": "https://gibs-{a-c}.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi"
+ "url": "https://uat.gibs.earthdata.nasa.gov/wmts/epsg4326/all/wmts.cgi"
},
"GIBS:wms": {
- "url": "https://gibs-{a-c}.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi"
+ "url": "https://uat.gibs.earthdata.nasa.gov/wms/epsg4326/all/wms.cgi"
},
"GIBS:wms:arctic": {
"url": "https://gibs-{a-c}.earthdata.nasa.gov/wms/epsg3413/best/wms.cgi"
diff --git a/web/js/animation/gif.js b/web/js/animation/gif.js
index d5480a7e3..70cc318ee 100644
--- a/web/js/animation/gif.js
+++ b/web/js/animation/gif.js
@@ -578,7 +578,7 @@ export function animationGif(models, config, ui) {
delay: 1000 / interval
});
if (ui.anim.ui.getInterval() === 'minute') {
- intervalAmount = 10;
+ intervalAmount = 15;
} else {
intervalAmount = 1;
}
diff --git a/web/js/animation/ui.js b/web/js/animation/ui.js
index b892aa6be..a961944f1 100644
--- a/web/js/animation/ui.js
+++ b/web/js/animation/ui.js
@@ -199,9 +199,11 @@ export function animationUi(models, ui) {
* @returns {object} JS Date
*
*/
+
+ // # need to change subdaily argument for custom intervals - rework for all zoom levels presumably
self.nextDate = function (date) {
if (models.date.selectedZoom === 4) {
- return util.dateAdd(date, self.getInterval(), 10);
+ return util.dateAdd(date, self.getInterval(), 15);
} else {
return util.dateAdd(date, self.getInterval(), 1);
}
diff --git a/web/js/app.js b/web/js/app.js
index 9e0a6ae43..83b8abfeb 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -493,7 +493,7 @@ class App extends React.Component {
ui.dateWheels = dateWheels(models, config);
}
- console.log(models.date, ui.timeline)
+ console.log(models, ui)
ui.rubberband = imageRubberband(models, ui, config);
ui.image = imagePanel(models, ui, config);
diff --git a/web/js/components/timeline/timeline-axis.css b/web/js/components/timeline/timeline-axis.css
deleted file mode 100644
index 56c395e53..000000000
--- a/web/js/components/timeline/timeline-axis.css
+++ /dev/null
@@ -1,132 +0,0 @@
-@import url('https://fonts.googleapis.com/css?family=Roboto+Mono:500');
-
-html, body {
- background: #999;
- overflow-x: hidden;
- font-family: Arial, Helvetica, sans-serif;
-}
-
-#timelineContainer {
- /* margin-top: 200px;
- background: yellow; */
- position: absolute;
- top: 200px;
-}
-
-#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; */
-}
-
-.inner {
- background: rgba(0, 0, 0, 0.5);
- height: 71px;
- display: flex;
- flex-direction: row;
- align-items: center;
- border-top: 1.5px solid white;
-}
-
-.dateToolTip {
- background: rgb(233, 233, 233);
- font-size: 9px;
- text-align: center;
- border-radius: 5px;
- width: 110px;
- height: 25px;
- line-height: 25px;
- white-space: nowrap;
-}
-
-.gridShell {
- display: flex;
- flex-direction: row;
- align-items: center;
- position: 100px;
-}
-
-.grid {
- color: white;
- font-size: 12px;
- height: 75px;
-}
-
-.gridText {
- font-size: 24px;
- font-weight: 500;
- /* font-size: 10px; */
- /* font-family: Arial, Helvetica, sans-serif; */
- font-family: 'Roboto Mono', monospace;
- color: white;
- pointer-events: none;
- user-select: none;
-}
-
-line {
- pointer-events: none;
-}
-
-/* DEVELOPMENT */
-.line {
- top: 152px;
- width: 2px;
- height: 70px;
- background: rgba(21,21,255,0.4);
- position: absolute;
- pointer-events: none;
-}
-
-.linered {
- width: 3px;
- height: 70px;
- background: red;
- position: absolute;
- pointer-events: none;
-}
-
-.dateTempHolderTextBlock {
- height: 90px;
- width: 300px;
- border: 2px solid;
- text-align: center;
- font-size: 24px;
- background: rgba(0, 0, 0, 0.5);
- color: white;
-}
-
-.tick {
- margin-left: -1px;
-}
-
-form button, form input, form select {
- border: none;
- outline: 1px solid black;
- width: 96px;
- text-align: center;
-}
-form button {
- height: 30px;
-}
-form select {
- text-align-last: center;
- padding-left: 15px;
-}
-.incrementButton {
- width: 70px;
- height: 99px;
- font-weight: 700;
-}
-.changeZoomLevelButtons button {
- background: dimgrey;
- color: white;
-}
\ No newline at end of file
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index 45efd7d4c..5c6d7110a 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -93,7 +93,7 @@ class TimelineAxis extends React.Component {
// this.showHoverOff = this.showHoverOff.bind(this);
}
//? how do position and transforms change between scale changes? lock into one line would be ideal
- updateScale = (timeScale, axisWidthInput) => {
+ updateScale = (inputDate, timeScale, axisWidthInput) => {
let options = timeScaleOptions[timeScale].timeAxis;
let gridWidth = options.gridWidth;
let axisWidth = axisWidthInput ? axisWidthInput : this.state.axisWidth;
@@ -116,6 +116,8 @@ class TimelineAxis extends React.Component {
// let mockPropsSelectedDate = '1941-01-01';
// console.log(hoverTime, draggerDateActual, hoverTime)
let hoverTime = moment.utc(this.state.hoverTime);
+
+ hoverTime = inputDate ? moment.utc(inputDate) : hoverTime;
console.log(hoverTime.format())
let hoverTimeZero;
let hoverTimeNextZero;
@@ -144,8 +146,6 @@ class TimelineAxis extends React.Component {
hoverTimeNextZero = hoverTimeZero.clone().add(1, timeScale);
}
- // console.log(hoverTime.format(), hoverTimeZero.format(), hoverTimeNextZero.format())
-
// value of hover time, hover time timeunit zeroed, hover time next unit timeunit zeroed
let hoverTimeValue = hoverTime.valueOf();
let hoverTimeZeroValue = hoverTimeZero.valueOf();
@@ -156,19 +156,18 @@ class TimelineAxis extends React.Component {
let diffStartAndZeroed = hoverTimeValue - hoverTimeZeroValue;
let pixelsToAdd = diffStartAndZeroed / diffFactor;
- // console.log(pixelsToAdd)
-
- // console.log(hoverTime, hoverTime.format(), pixelsToAdd);
- // console.log(Math.floor(leftOffset / gridWidth));
//! offset grids needed since each zoom in won't be centered
//! maybe non equal past/future dates - this.getDateArray(80, 40, timeScale, hoverTime);
//! additional offset needed for midPoint and/or position
let offSetGrids = Math.floor(leftOffset / gridWidth);
+ let offSetGridsDiff = offSetGrids - Math.floor(numberOfVisibleTiles / 2);
+ let gridsToSubtract = Math.floor(gridNumber/2) + offSetGridsDiff;
+ let gridsToAdd = Math.floor(gridNumber/2) - offSetGridsDiff;
// console.log(Math.floor(gridNumber/2), offSetGrids, gridNumber/2)
//# MOST EXPENSIVE FUNCTION!!!! Greater the gridNumber === longer. 960 els ~23ms vs 100 at 3.5ms)
- let current = this.getDateArray(Math.floor(gridNumber/2), Math.floor(gridNumber/2), timeScale, hoverTime);
+ let current = this.getDateArray(gridsToSubtract, gridsToAdd, timeScale, hoverTime);
// console.log(current)
let deque = new Deque(current.dates);
@@ -183,16 +182,8 @@ class TimelineAxis extends React.Component {
let draggerPosition = 0;
let draggerVisible = false;
if (isBetween) {
- // let frontDateValue = moment.utc(frontDate.rawDate).valueOf(); // ZERO
- // let draggerPositionFromFront = draggerDateActualValue - frontDateValue;
-
- // pixelsToAddToDragger = Math.abs(frontDate.diff(draggerDateActual, timeScale, true) * gridWidth);
draggerPosition = Math.abs(frontDate.diff(draggerDateActual, timeScale, true) * gridWidth);
draggerVisible = true;
- //? WHY IS THIS OFFSET REQUIRED? seems consistent throughout browser size changes too
- // if(timeScale === 'month') {
- // pixelsToAddToDragger += 54;
- // }
}
let draggerPositionB = 0;
@@ -211,25 +202,21 @@ class TimelineAxis extends React.Component {
if (axisWidthInput) {
position = midPoint;
} else {
- position = +(midPoint - (axisWidth / 2 - leftOffset)).toFixed(10);
+ // - (offSetGridsDiff * gridWidth) to compensate off center zooming repositioning
+ position = +(midPoint - (axisWidth / 2 - leftOffset)).toFixed(10) - (offSetGridsDiff * gridWidth);
if (gridNumber % 2 !== 0) {
position += gridWidth/2;
}
- // let position2 = midPoint - (axisWidth / 2 - leftOffset);
- // console.log(position, position2)
- // console.log(midPoint, position, (axisWidth / 2 - leftOffset), axisWidth / 2, leftOffset)
}
// console.log(pixelsToAddToDragger, midPoint, (axisWidth / 2 - leftOffset), pixelsToAdd, position)
if (timeScale === 'year') {
- // let axOff = axisWidth / 2 - leftOffset;
position = 0 + axisWidth / 2 + (leftOffset - axisWidth / 2);
}
let currentTransformX = 0;
//? this.addLine(...) added as a callback in this.setState due to relying on changed timescale/grid state
//? can change later if passing more arguments is more performant or required due to asynchronous behavior of setState
// console.log(midPoint, position, pixelsToAdd, leftOffset);
-
// console.log(draggerPosition - pixelsToAdd + position - 49)
// console.log(draggerPositionB - pixelsToAdd + position - 49)
this.setState({
@@ -325,7 +312,6 @@ class TimelineAxis extends React.Component {
let dragSentinelCount = this.state.dragSentinelCount;
//# PRE/POST GRIDARRAY UPDATE NOT NECESSARY FOR YEAR SINCE ALL YEARS DISPLAYED
if (timeScale === 'year') {
- console.log('YEAR', draggerPosition);
this.setState({
draggerPosition: draggerPosition,
draggerPositionB: draggerPositionB,
@@ -605,7 +591,7 @@ class TimelineAxis extends React.Component {
// let axisWidth = Math.floor(window.innerWidth * 0.9);
let axisWidth = this.props.width;
let timeScale = this.state.timeScale;
- this.updateScale(timeScale, axisWidth);
+ this.updateScale(null, timeScale, axisWidth);
console.log('resize')
this.setState({
axisWidth: axisWidth
@@ -745,7 +731,7 @@ class TimelineAxis extends React.Component {
// console.log(propsSelectedDate, stateSelectedDate)
if (this.state.timeScale !== prevState.timeScale) {
- this.updateScale(this.state.timeScale);
+ this.updateScale(null, this.state.timeScale);
}
if (this.props.width !== prevProps.width) {
@@ -768,18 +754,21 @@ class TimelineAxis extends React.Component {
// console.log(newSelectedDate.format(), frontDate.format(), manualTimeScaleChangeUnit, gridWidth)
// console.log(moment.utc(this.props.selectedDate).format(), moment.utc(prevProps.selectedDate).format())
let newDraggerPosition = this.getDraggerPosition(newSelectedDate, frontDate, manualTimeScaleChangeUnit, gridWidth)
- // console.log(this.state.draggerPosition, newDraggerPosition)
+ console.log(this.state.draggerPosition, newDraggerPosition)
- if (this.props.changeAmt !== null) {
- if (this.props.changeAmt > 0) {
- this.addTimeUnit(manualTimeScaleChangeUnit, this.props.changeAmt)
- this.props.incrementDate(manualTimeScaleChangeUnit, this.props.changeAmt);
- } else {
- this.minusTimeUnit(manualTimeScaleChangeUnit, -this.props.changeAmt)
- this.props.incrementDate(manualTimeScaleChangeUnit, this.props.changeAmt);
- }
- }
+ this.setDraggerToTime(this.props.selectedDate)
+ // if (this.props.changeAmt !== null) {
+ // console.log('hit')
+ // if (this.props.changeAmt > 0) {
+ // this.addTimeUnit(manualTimeScaleChangeUnit, this.props.changeAmt)
+ // // this.props.incrementDate(manualTimeScaleChangeUnit, this.props.changeAmt);
+ // } else {
+ // this.minusTimeUnit(manualTimeScaleChangeUnit, -this.props.changeAmt)
+ // // this.props.incrementDate(manualTimeScaleChangeUnit, this.props.changeAmt);
+ // }
+
+ // }
}
// else if (propsSelectedDate !== stateSelectedDate) {
// this.setState({
@@ -790,6 +779,44 @@ class TimelineAxis extends React.Component {
// }
}
+ // move red line forward one timeScale unit and update time
+ setDraggerToTime = (inputTime) => {
+ console.log(inputTime)
+ // let timeScaleSelected = manualTimeScaleChangeUnit ? manualTimeScaleChangeUnit : this.state.timeScaleSelectValue;
+ let frontDate = moment.utc(this.state.deque.peekFront().rawDate);
+ let backDate = moment.utc(this.state.deque.peekBack().rawDate);
+ // let increment = manualIncrementAmount ? manualIncrementAmount : this.state.increment;
+ let draggerTimeState = moment.utc(this.state.draggerTimeState, 'YYYY-MM-DDTHH:mm:ss.SSSZ');
+ let draggerTimeStateAdded = moment.utc(inputTime);
+
+ let isBetween = draggerTimeStateAdded.isBetween(frontDate, backDate, null, '[]');
+ let draggerVisible = false;
+ let newDraggerPosition;
+ if (isBetween) {
+ draggerVisible = true;
+ }
+ let gridWidth = this.state.gridWidth;
+ let timeScale = this.state.timeScale;
+ let pixelsToAddToDragger = Math.abs(frontDate.diff(draggerTimeState, timeScale, true) * gridWidth);
+ let pixelsToAddToDraggerNew = Math.abs(frontDate.diff(draggerTimeStateAdded, timeScale, true) * gridWidth);
+ let pixelsToAddBasedOnFrontDate = pixelsToAddToDraggerNew - pixelsToAddToDragger;
+
+ let isVisible = this.state.draggerVisible;
+ if (isVisible) {
+ newDraggerPosition = this.state.draggerPosition + pixelsToAddBasedOnFrontDate;
+ } else {
+ newDraggerPosition = pixelsToAddToDraggerNew + this.state.position - 49 + this.state.currentTransformX;
+ }
+
+ this.setState({
+ draggerPosition: newDraggerPosition,
+ draggerVisible: draggerVisible,
+ draggerTimeState: draggerTimeStateAdded.format(),
+ selectedDate: draggerTimeStateAdded.format(),
+ })
+ // this.props.incrementDate(timeScaleSelected, increment));
+ }
+
// TODO: may need to restrict based on zoom levels, year zoom adding 7 minutes does nothing for example
// move red line forward one timeScale unit and update time
addTimeUnit = (manualTimeScaleChangeUnit, manualIncrementAmount) => {
@@ -823,7 +850,7 @@ class TimelineAxis extends React.Component {
draggerPosition: newDraggerPosition,
draggerVisible: draggerVisible,
draggerTimeState: draggerTimeStateAdded.format(),
- },)
+ }, this.props.updateDate(draggerTimeStateAdded.format()))
// this.props.incrementDate(timeScaleSelected, increment));
}
@@ -859,7 +886,7 @@ class TimelineAxis extends React.Component {
draggerPosition: newDraggerPosition,
draggerVisible: draggerVisible,
draggerTimeState: draggerTimeStateSubtracted.format(),
- },)
+ }, this.props.updateDate(draggerTimeStateSubtracted.format()))
// this.props.incrementDate(timeScaleSelected, increment));
}
@@ -891,81 +918,152 @@ class TimelineAxis extends React.Component {
})
}
- // handle dragger dragging
- handleDragDragger = (draggerName, e, d) => {
- // console.log(e,d, draggerName)
- if (e) {
- e.stopPropagation();
- e.preventDefault();
- }
+// handle dragger dragging
+handleDragDragger = (draggerName, e, d) => {
+ // console.log(e,d, draggerName)
+ if (e) {
+ e.stopPropagation();
+ e.preventDefault();
+ }
- requestAnimationFrame(() => {
- // var deltaX = d.deltaX || e.movementX; //# NOT THE SAME
- var deltaX = d.deltaX;
- let gridWidth = this.state.gridWidth;
- let timeScale = this.state.timeScale;
- let axisWidth = this.state.axisWidth;
+ requestAnimationFrame(() => {
+ // var deltaX = d.deltaX || e.movementX; //# NOT THE SAME
+ var deltaX = d.deltaX;
+ let gridWidth = this.state.gridWidth;
+ let timeScale = this.state.timeScale;
+ let axisWidth = this.state.axisWidth;
+ let dragSentinelChangeNumber = this.state.dragSentinelChangeNumber;
+ let dragSentinelCount = this.state.dragSentinelCount;
- let time;
- let draggerPosition;
- if (draggerName === 'A') {
- draggerPosition = this.state.draggerPosition + deltaX;
- time = this.state.draggerTimeState;
- } else { // draggerName === 'B'
- draggerPosition = this.state.draggerPositionB + deltaX;
- time = this.state.draggerTimeStateB;
- }
+ let time;
+ let draggerPosition;
+ if (draggerName === 'A') {
+ draggerPosition = this.state.draggerPosition + deltaX;
+ time = this.state.draggerTimeState;
+ } else { // draggerName === 'B'
+ draggerPosition = this.state.draggerPositionB + deltaX;
+ time = this.state.redLineTimeB;
+ }
- // console.log(draggerPosition, time)
- // update draggerTimeState based on deltaX from state draggerTimeState
- // TODO: test consistency throught timescales, currently seems off 0.5 on ocassion
- let draggerTime = moment.utc(time);
- let draggerTimeZero = draggerTime.clone().startOf(timeScale);
- let draggerTimeNextZero = draggerTimeZero.clone().add(1, timeScale);
+ // console.log(draggerPosition, time)
+ // update redLineTime based on deltaX from state redLineTime
+ // TODO: test consistency throught timescales, currently seems off 0.5 on ocassion
+ let draggerTime = moment.utc(time);
+ let draggerTimeZero = draggerTime.clone().startOf(timeScale);
+ let draggerTimeNextZero = draggerTimeZero.clone().add(1, timeScale);
- let draggerTimeValue = draggerTime.valueOf();
- let draggerTimeZeroValue = draggerTimeZero.valueOf();
- let draggerTimeNextZeroValue = draggerTimeNextZero.valueOf();
+ let draggerTimeValue = draggerTime.valueOf();
+ let draggerTimeZeroValue = draggerTimeZero.valueOf();
+ let draggerTimeNextZeroValue = draggerTimeNextZero.valueOf();
- let diffZeroValues = draggerTimeNextZeroValue - draggerTimeZeroValue;
- let diffFactor = diffZeroValues / gridWidth;
- let newDraggerTime = moment.utc(draggerTimeValue + (diffFactor * deltaX)).format();
+ let diffZeroValues = draggerTimeNextZeroValue - draggerTimeZeroValue;
+ let diffFactor = diffZeroValues / gridWidth;
+ let newDraggerTime = moment.utc(draggerTimeValue + (diffFactor * deltaX)).format();
+
+ // handle drag timeline
+ // TODO: updatePanel
+ if (draggerPosition < -49) { // 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 { currentDateRange,
+ deque,
+ currentTransformX,
+ draggerVisible,
+ draggerVisibleB,
+ overDragGrids,
+ draggerPositionRevision } = this.updatePanelDateRange(position, timeScale, -deltaX, draggerPosition, overDrag);
- // handle drag timeline
- // TODO: updatePanel
- if (draggerPosition < -49) { // handle drag timeline towards PAST
this.setState({
+ currentDateRange: currentDateRange,
+ deque: deque,
+ currentTransformX: currentTransformX,
draggerPosition: -48,
moved: true,
- position: this.state.position - deltaX * 2
+ position: position,
+ dragSentinelCount: (dragSentinelCount + deltaX) - -dragSentinelChangeNumber + (overDragGrids * gridWidth),
})
- } else if (draggerPosition > axisWidth - 49) { // handle drag timeline towards FUTURE
+ } else {
+ let newDragSentinelCount = dragSentinelCount > 0 ? (-dragSentinelChangeNumber + dragSentinelCount + deltaX) : dragSentinelCount + deltaX;
+
+ // NEGATIVE DELTAX
this.setState({
- draggerPosition: axisWidth - 50,
+ draggerPosition: -48,
moved: true,
- position: this.state.position - deltaX * 2
+ position: position,
+ dragSentinelCount: newDragSentinelCount
})
- } else { // handle drag within axis view
- if (draggerName === 'A') {
- this.setState({
- draggerPosition: draggerPosition,
- draggerTimeState: newDraggerTime,
- moved: true,
- draggerSelected: true,
- draggerSelectedB: false,
- }, this.props.updateDate(newDraggerTime));
- } else {
- this.setState({
- draggerPositionB: draggerPosition,
- draggerTimeStateB: newDraggerTime,
- moved: true,
- draggerSelected: false,
- draggerSelectedB: true,
- });
+ }
+ } else if (draggerPosition > axisWidth - 49) { // 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 { currentDateRange,
+ deque,
+ currentTransformX,
+ draggerVisible,
+ draggerVisibleB,
+ overDragGrids,
+ draggerPositionRevision } = this.updatePanelDateRange(position, timeScale, -deltaX, draggerPosition, overDrag);
+
+ this.setState({
+ currentDateRange: currentDateRange,
+ deque: deque,
+ currentTransformX: currentTransformX,
+ 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
+ if (draggerName === 'A') {
+ console.log(newDraggerTime)
+ this.setState({
+ draggerPosition: draggerPosition,
+ redLineTime: newDraggerTime,
+ draggerTimeState: newDraggerTime,
+ moved: true,
+ draggerSelected: true,
+ draggerSelectedB: false,
+ }, this.props.updateDate(newDraggerTime));
+ } else {
+ this.setState({
+ draggerPositionB: draggerPosition,
+ redLineTimeB: newDraggerTime,
+ moved: true,
+ draggerSelected: false,
+ draggerSelectedB: true,
+ });
+ }
+ }
+ })
+}
// select dragger
selectDragger = (draggerName) => {
@@ -977,29 +1075,29 @@ class TimelineAxis extends React.Component {
}
//# HANDLE INCREMENT FORM TESTING
-// handleChangeZoomLevel(event) {
-// event.preventDefault();
-// this.setState({
-// timeScale: event.target.value,
-// leftOffset: this.state.axisWidth/2
-// });
-// }
-
-// handleChange(event) {
-// this.setState({ increment: Number(event.target.value) });
-// }
-
-// handleSubmit(event) {
-// event.preventDefault();
-// }
-
-// handleReset(event) {
-// this.setState({ increment: 1 });
-// }
-
-// handleTimeScaleSelectChange(event) {
-// this.setState({ timeScaleSelectValue: event.target.value })
-// }
+ handleChangeZoomLevel(event) {
+ event.preventDefault();
+ this.setState({
+ timeScale: event.target.value,
+ leftOffset: this.state.axisWidth/2
+ });
+ }
+
+ handleChange(event) {
+ this.setState({ increment: Number(event.target.value) });
+ }
+
+ handleSubmit(event) {
+ event.preventDefault();
+ }
+
+ handleReset(event) {
+ this.setState({ increment: 1 });
+ }
+
+ handleTimeScaleSelectChange(event) {
+ this.setState({ timeScaleSelectValue: event.target.value })
+ }
showHoverOn = () => {
this.setState({ showHoverLine: true });
@@ -1028,7 +1126,7 @@ class TimelineAxis extends React.Component {
window.moment = moment;
return (
<div>
- {/* <div style={{display: 'flex', position: 'relative', left: (window.innerWidth * 0.05)}}>
+ <div style={{display: 'flex', position: 'relative', left: (window.innerWidth * 0.05)}}>
<div style={{display: 'flex', background: '#999', border: '1px solid black', width: '155px', height: '100px'}}>
<form onSubmit={this.handleSubmit.bind(this)}>
<label>
@@ -1058,7 +1156,7 @@ class TimelineAxis extends React.Component {
<div>
<button onClick={(e) => this.toggleCompareMode(e)}>Compare Mode</button>
</div>
- </div> */}
+ </div>
<div id="wv-timeline-axis"
// ref={this.timelineRef} //# REF
style={{width: `${this.state.axisWidth}px`}}
diff --git a/web/js/components/timeline/timeline-controls/date-change-controls.js b/web/js/components/timeline/timeline-controls/date-change-controls.js
index 875bf8c53..d011769a8 100644
--- a/web/js/components/timeline/timeline-controls/date-change-controls.js
+++ b/web/js/components/timeline/timeline-controls/date-change-controls.js
@@ -23,7 +23,7 @@ class DateChangeControls extends React.Component {
// }
componentDidUpdate() {
- // console.log('update')
+ console.log('update', this.props.selectedDate)
}
render() {
@@ -36,7 +36,7 @@ class DateChangeControls extends React.Component {
fontSize: null,
height: '30',
id: 'main-TEST',
- idSuffix: 'animation-widget-main',
+ idSuffix: 'date-selector-main',
maxDate: new Date('2020-01-01T00:00:00.000'),
maxZoom: 5, // 3 === DAY, 5 TRIGGERS CONDITIONAL TO SHOW SUBDAILY
minDate: new Date('1940-01-01T00:00:00.000'),
diff --git a/web/js/components/timeline/timeline.css b/web/js/components/timeline/timeline.css
index e90371c44..af284528e 100644
--- a/web/js/components/timeline/timeline.css
+++ b/web/js/components/timeline/timeline.css
@@ -79,7 +79,7 @@ line {
/* DEVELOPMENT */
.line {
- top: 2px;
+ top: 102px;
width: 2px;
height: 70px;
background: rgba(21,21,255,0.4);
@@ -130,4 +130,8 @@ form select {
.changeZoomLevelButtons button {
background: dimgrey;
color: white;
+}
+
+#timelineContainer > div:nth-child(1) > div.wv-date-selector-widget {
+ background: #999;
}
\ No newline at end of file
diff --git a/web/js/components/timeline/timeline.js b/web/js/components/timeline/timeline.js
index 5392f4b5a..b3d0cfc5a 100644
--- a/web/js/components/timeline/timeline.js
+++ b/web/js/components/timeline/timeline.js
@@ -21,6 +21,7 @@ class Timeline extends React.Component {
};
}
+ //# may not be necessary if incrementing doesn't matter for performance
dateChange = (date, id, type, amt) => {
// console.log(date, id, type, amt)
let dateFormatted = date.toISOString();
@@ -44,7 +45,7 @@ class Timeline extends React.Component {
}
componentDidUpdate() {
- // console.log('CDU')
+ console.log('CDU', this.state)
}
componentDidMount() {
@@ -70,7 +71,7 @@ class Timeline extends React.Component {
}
render() {
- // console.log(this.state)
+ console.log(this.props.selectedDate, this.state.dateFormatted)
// let dateFormatted = this.state.selectedDate.toISOString();
// let tempStyle = {
// position: 'absolute',
@@ -92,7 +93,7 @@ class Timeline extends React.Component {
return (
this.state.dateFormatted ?
<React.Fragment>
- <DateChangeControls selectedDate={this.state.dateFormatted} dateChange={this.dateChange} />
+ <DateChangeControls selectedDate={this.state.dateFormatted} dateChange={this.updateDate} />
{/* <TimelineAxis {...this.state} selectedDate={dateFormatted}/> */}
{/* new modular version - currently a shell */}
diff --git a/web/js/date/model.js b/web/js/date/model.js
index 44c4585a0..f52286387 100644
--- a/web/js/date/model.js
+++ b/web/js/date/model.js
@@ -42,7 +42,7 @@ export function dateModel(models, config, spec) {
};
self.select = function(date, selectionStr) {
- // console.log(date, selectionStr)
+ console.log(date)
if (!date) return null;
selectionStr = selectionStr || self.activeDate;
date = self.clamp(date);
diff --git a/web/js/date/timeline-input.js b/web/js/date/timeline-input.js
index 6040c997d..11676e81b 100644
--- a/web/js/date/timeline-input.js
+++ b/web/js/date/timeline-input.js
@@ -22,6 +22,8 @@ export function timelineInput(models, config, ui) {
var animator = null;
var keyDown;
+ let animationInProcess = false;
+
var $incrementBtn = $('#right-arrow-group');
var $decrementBtn = $('#left-arrow-group');
@@ -41,7 +43,7 @@ export function timelineInput(models, config, ui) {
self.animateByIncrement(1, 'day');
break;
case 4:
- self.animateByIncrement(10, 'minute');
+ self.animateByIncrement(1, 'minute');
break;
default:
self.animateByIncrement(1, 'day');
@@ -63,17 +65,17 @@ export function timelineInput(models, config, ui) {
self.animateByIncrement(-1, 'day');
break;
case 4:
- self.animateByIncrement(-10, 'minute');
+ self.animateByIncrement(-1, 'minute');
break;
default:
self.animateByIncrement(-1, 'day');
}
})
.mouseup(stopper);
+
$(document)
.mouseout(stopper)
.keydown(function(event) {
- console.log('asdasd')
if (event.target.nodeName === 'INPUT' || keyDown === event.keyCode) {
return;
}
@@ -90,7 +92,7 @@ export function timelineInput(models, config, ui) {
self.animateByIncrement(-1, 'day');
break;
case 4:
- self.animateByIncrement(-10, 'minute');
+ self.animateByIncrement(-1, 'minute');
break;
}
break;
@@ -106,7 +108,7 @@ export function timelineInput(models, config, ui) {
self.animateByIncrement(1, 'day');
break;
case 4:
- self.animateByIncrement(10, 'minute');
+ self.animateByIncrement(1, 'minute');
break;
}
event.preventDefault();
@@ -190,7 +192,7 @@ export function timelineInput(models, config, ui) {
function animate() {
var nextTime = getNextTimeSelection(delta, increment);
- console.log(tl.data.start(), nextTime, endTime)
+ console.log(tl.data.start(), nextTime, endTime, increment)
if (ui.timeline.config.currentZoom >= 4) {
if (tl.data.start() <= nextTime && nextTime <= endTime) {
models.date.add(increment, delta);
@@ -200,6 +202,7 @@ export function timelineInput(models, config, ui) {
models.date.add(increment, delta);
}
}
+ animationInProcess = true;
animator = setTimeout(animate, self.delay);
}
animate();
@@ -210,11 +213,14 @@ export function timelineInput(models, config, ui) {
* @return {void}
*/
var stopper = function() {
- // invokes when mouse over < > and date selector arrows/boxes
- // sticks on new timeline date selector
- console.log('STOPPPPPPPP')
- clearInterval(animator);
- animator = 0;
+ if (animationInProcess) {
+ animationInProcess = false;
+ // # invokes when mouse over < > and date selector arrows/boxes
+ // # sticks on new timeline date selector
+ console.log('STOPPPPPPPP')
+ clearInterval(animator);
+ animator = 0;
+ }
};
/**
* @param {Number} delta Date and direction to change
diff --git a/web/js/date/timeline.js b/web/js/date/timeline.js
index c1480b2f7..e68cdc006 100644
--- a/web/js/date/timeline.js
+++ b/web/js/date/timeline.js
@@ -146,7 +146,8 @@ export function timeline(models, config, ui) {
// self.expand(true);
// console.log(timeScale, increment)
// models.date.add(timeScale, increment);
- self.input.animateByIncrement(increment, timeScale);
+ // self.input.animateByIncrement(increment, timeScale);
+ // models.date.select(date);
};
var updateDate = (date) => {
@@ -154,7 +155,7 @@ export function timeline(models, config, ui) {
// console.log(models)
// self.input.update(updatedDate);
// models.date.setActiveDate(updatedDate);
-
+console.log('updateDate', updatedDate)
//# ALLOWS UPDATE OF MODELS DATE WHICH LAYERS IS CONNECTED TO
models.date.select(updatedDate);
};
@@ -174,7 +175,6 @@ export function timeline(models, config, ui) {
var drawContainers = function() {
self.getWidth();
- console.log(self.width)
let initialProps = getInitialProps();
self.reactComponent = ReactDOM.render(
React.createElement(Timeline, initialProps),
@@ -245,8 +245,11 @@ export function timeline(models, config, ui) {
var updateReactTimelineDate = function() {
let selectedDate = models.date[models.date.activeDate];
- // console.log(selectedDate)
- self.reactComponent.setState({ selectedDate: selectedDate });
+ console.log(selectedDate, new Date(selectedDate).toISOString())
+ self.reactComponent.setState({
+ selectedDate: selectedDate,
+ dateFormatted: new Date(selectedDate).toISOString()
+ });
};
var updateTimeUi = function() {
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index f4e33d44a..b076b22e3 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -115,6 +115,7 @@ export function mapLayerBuilder(models, config, cache, mapUi) {
* @return {object} Closest date
*/
self.closestDate = function(def, options) {
+ console.log(def)
var date;
var animRange;
if (models.anim) {