Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix input arrow date change discrepancy with 23 and 1 hour changes to zero, hide scale on zoom scale dialog hover

Edward Plato3d0511c10e5b
diff --git a/web/js/components/date-selector/date-selector.js b/web/js/components/date-selector/date-selector.js
index 2e3a17d2c..3d8d909d2 100644
--- a/web/js/components/date-selector/date-selector.js
+++ b/web/js/components/date-selector/date-selector.js
@@ -34,13 +34,6 @@ class DateSelector extends React.Component {
hasSubdailyLayers: props.hasSubdailyLayers
});
}
- // shouldComponentUpdate(prevProps, prevState) {
- // console.log(prevProps.date, prevState.date, this.props.date, this.state.date)
- // if (prevProps.date === this.props.date) {
- // return false;
- // }
- // return true;
- // }
blur() {
this.setState({ tab: null });
}
@@ -50,7 +43,6 @@ class DateSelector extends React.Component {
changeTab(index) {
var nextTab = index;
var maxTab;
- // if (this.state.maxZoom >= 4) {
if (this.state.hasSubdailyLayers) {
maxTab = 5;
} else {
@@ -131,7 +123,6 @@ class DateSelector extends React.Component {
}
}
render() {
- console.log(this.props.date)
return (
<div className="wv-date-selector-widget">
<DateInputColumn
diff --git a/web/js/components/date-selector/input.js b/web/js/components/date-selector/input.js
index 6c288c3c4..10339566e 100644
--- a/web/js/components/date-selector/input.js
+++ b/web/js/components/date-selector/input.js
@@ -119,23 +119,13 @@ class DateInputColumn extends React.Component {
}
}
onClickUp() {
- if (this.props.type === 'minute') {
- // this.rollDate(10);
- this.rollDate(1);
- } else {
- this.rollDate(1);
- }
+ this.rollDate(1);
this.setState({
valid: true
});
}
onClickDown() {
- if (this.props.type === 'minute') {
- // this.rollDate(-10);
- this.rollDate(-1);
- } else {
- this.rollDate(-1);
- }
+ this.rollDate(-1);
this.setState({
valid: true
});
@@ -189,6 +179,7 @@ class DateInputColumn extends React.Component {
hourValidation(input) {
var newDate;
+ console.log(input, this.validateDate(newDate));
if (input >= 0 && input <= 23) {
newDate = new Date(new Date(this.props.date).setUTCHours(input));
return this.validateDate(newDate);
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis-container.js b/web/js/components/timeline/timeline-axis/timeline-axis-container.js
index fdfa9f5d8..9fc927422 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis-container.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis-container.js
@@ -10,7 +10,6 @@ class TimelineAxisContainer extends React.Component {
}
render() {
- // console.log(this.props)
return (
<React.Fragment>
<TimelineAxis {...this.props} />
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index 44302281f..01f3188a7 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -759,7 +759,8 @@ class TimelineAxis extends React.Component {
componentDidUpdate(prevProps, prevState) {
// console.log(prevProps.selectedDate, this.props.selectedDate, this.state.selectedDate, prevState.selectedDate)
-console.log(this.props.timeScale)
+ // console.log(prevProps.dateFormatted, this.props.dateFormatted)
+// console.log(this.props.timeScale)
if (this.props.inputChange === true) {
this.props.resetInput();
// check if newDraggerDate will be within acceptable visible axis width
@@ -1065,6 +1066,8 @@ handleDragDragger = (draggerName, e, d) => {
// TODO: debug globals added to window temporarily
window.deque = Deque;
window.moment = moment;
+ // console.log(this.props, this.state);
+ // debugger;
return (
<React.Fragment>
<div id="wv-timeline-axis"
diff --git a/web/js/components/timeline/timeline-controls/axis-zoom-change.js b/web/js/components/timeline/timeline-controls/axis-zoom-change.js
index 77a85b46c..3e8fb7ea8 100644
--- a/web/js/components/timeline/timeline-controls/axis-zoom-change.js
+++ b/web/js/components/timeline/timeline-controls/axis-zoom-change.js
@@ -23,7 +23,24 @@ class AxisZoomChange extends React.Component {
// Toggle zoom select tooltip
toggleTooltipHover = (isHovered) => {
- console.log(isHovered)
+ // toggle visibility of map scales
+ let imperialMapScale = document.querySelectorAll('.wv-map-scale-imperial');
+ let metricMapScale = document.querySelectorAll('.wv-map-scale-metric');
+ if (isHovered) {
+ for (let el of imperialMapScale) {
+ el.style.display = 'none';
+ }
+ for (let el of metricMapScale) {
+ el.style.display = 'none';
+ }
+ } else {
+ for (let el of imperialMapScale) {
+ el.style.display = 'block';
+ }
+ for (let el of metricMapScale) {
+ el.style.display = 'block';
+ }
+ }
this.setState({
toolTipHovered: isHovered
})
@@ -107,7 +124,6 @@ class AxisZoomChange extends React.Component {
}
render() {
- console.log(this.props)
return (
this.state.zoomLevel ?
<div
diff --git a/web/js/components/timeline/timeline.js b/web/js/components/timeline/timeline.js
index 2499970f8..83d4c5959 100644
--- a/web/js/components/timeline/timeline.js
+++ b/web/js/components/timeline/timeline.js
@@ -1,6 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
+import moment from 'moment';
+
import DateChangeControls from './timeline-controls/date-change-controls';
import DateZoomChange from './timeline-controls/date-zoom-change';
import './timeline.css';
@@ -52,13 +54,13 @@ class Timeline extends React.Component {
updateDate = (date, inputChange) => {
console.log(date, inputChange)
- if (inputChange) {
- this.setState({
- inputChange: true
- }, this.props.updateDate(date));
- } else {
+ // if (inputChange) {
+ // this.setState({
+ // inputChange: true
+ // }, this.props.updateDate(date));
+ // } else {
this.props.updateDate(date);
- }
+ // }
// let dateFormatted = new Date(date).toISOString();
// this.setState({
@@ -73,6 +75,7 @@ class Timeline extends React.Component {
});
}
+ // show/hide custom interval modal
toggleCustomIntervalModal = () => {
this.setState(prevState => ({
customIntervalModalOpen: !prevState.customIntervalModalOpen
@@ -89,6 +92,12 @@ class Timeline extends React.Component {
}
componentDidUpdate(prevProps, prevState) {
+ console.log(this.state.dateFormatted, prevState.dateFormatted)
+ // if(this.state.dateFormatted !== prevState.dateFormatted) {
+ // this.setState({
+ // dateFormatted: this.props.dateFormatted
+ // })
+ // }
// console.log('CDU', this.state, this.props)
}
@@ -158,8 +167,12 @@ class Timeline extends React.Component {
}
// left/right arrows increment date
incrementDate = (multiplier) => {
- console.log(this.state.changeAmt, this.state.timeScaleChangeUnit)
- this.props.incrementDate((multiplier * this.state.changeAmt), this.state.timeScaleChangeUnit);
+ console.log(moment(this.state.dateFormatted).format(), moment.utc(this.state.dateFormatted).format())
+ let newDate = moment.utc(this.state.dateFormatted).add((multiplier * this.state.changeAmt), this.state.timeScaleChangeUnit)
+
+ // this.props.incrementDate((multiplier * this.state.changeAmt), this.state.timeScaleChangeUnit);
+ console.log(this.state.dateFormatted, newDate.format())
+ this.updateDate(new Date(newDate.format()));
}
// open animation dialog
diff --git a/web/js/date/model.js b/web/js/date/model.js
index 1508a598a..b82b25728 100644
--- a/web/js/date/model.js
+++ b/web/js/date/model.js
@@ -42,7 +42,6 @@ export function dateModel(models, config, spec) {
};
self.select = function(date, selectionStr) {
- console.log(date, self.selected)
if (!date) return null;
selectionStr = selectionStr || self.activeDate;
date = self.clamp(date);
@@ -56,15 +55,16 @@ export function dateModel(models, config, spec) {
self.events.trigger('select', date, selectionStr);
}
updated = true;
+ } else {
+ // necessary to handle 00:00:00 not triggering and saving as either the
+ // previous date of 23:00:00 or 01:00:00 - what is the reason for this?
+ self.events.trigger('select', date, selectionStr);
}
return updated;
};
self.add = function(interval, amount, selectionStr) {
- console.log(interval, amount, selectionStr)
selectionStr = selectionStr || self.activeDate;
- console.log(interval, amount, selectionStr)
- console.log(self[selectionStr])
self.select(
util.dateAdd(self[selectionStr], interval, amount),
selectionStr
@@ -88,7 +88,6 @@ export function dateModel(models, config, spec) {
date = startDate;
}
}
- console.log(date)
return date;
};
diff --git a/web/js/date/timeline.js b/web/js/date/timeline.js
index bc6ddab21..8f6d87450 100644
--- a/web/js/date/timeline.js
+++ b/web/js/date/timeline.js
@@ -463,8 +463,9 @@ export function timeline(models, config, ui) {
};
var updateDate = (date) => {
- let updatedDate = new Date(date);
console.log(date)
+ let updatedDate = new Date(date);
+ console.log(date, updatedDate)
// console.log(models)
// self.input.update(updatedDate);
// models.date.setActiveDate(updatedDate);
diff --git a/web/js/util/util.js b/web/js/util/util.js
index c07e3fbd3..c757ec820 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -592,7 +592,6 @@ export default (function (self) {
};
self.rollDate = function (date, interval, amount, minDate, maxDate) {
- console.log(date, interval, amount, minDate, maxDate)
minDate = minDate || self.minDate();
maxDate = maxDate || self.maxDate();
var range = self.rollRange(date, interval, minDate, maxDate);
@@ -633,7 +632,6 @@ export default (function (self) {
}
var newDate = new Date(Date.UTC(year, month, day, hour, minute, second));
newDate = new Date(self.clamp(newDate, minDate, maxDate));
- console.log(newDate)
return newDate;
};