Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

refactor selectDragger to use new compare state/actions, fix date selector to update focused date in A/B mode and upon exiting when focused on A or B dragger

Edward Plato050d9ab6bb6d
diff --git a/web/js/components/date-selector/date-selector.js b/web/js/components/date-selector/date-selector.js
index 3900de45d..b0fa6566b 100644
--- a/web/js/components/date-selector/date-selector.js
+++ b/web/js/components/date-selector/date-selector.js
@@ -17,24 +17,9 @@ class DateSelector extends React.Component {
constructor(props) {
super(props);
this.state = {
- // date: props.draggerSelected === 'selectedB' ? props.dateB : props.date,
- // maxDate: props.maxDate,
- // minDate: props.minDate,
tab: null
- // maxZoom: props.maxZoom,
- // hasSubdailyLayers: props.hasSubdailyLayers
};
}
- // componentWillReceiveProps(props) {
- // this.setState({
- // // date: props.draggerSelectedB ? props.dateB : props.date,
- // // date: props.draggerSelected === 'selectedB' ? props.dateB : props.date,
- // maxDate: props.maxDate,
- // minDate: props.minDate,
- // // maxZoom: props.maxZoom,
- // hasSubdailyLayers: props.hasSubdailyLayers
- // });
- // }
blur() {
this.setState({ tab: null });
}
@@ -67,24 +52,24 @@ class DateSelector extends React.Component {
updateDate(date, type, amt) {
// this.props.onDateChange(date, this.props.id, type, amt);
// # allows dragger change via main date selector, and id change via anim date selectors
- console.log(date)
this.props.onDateChange(date, this.props.id);
}
renderSubdaily() {
if (this.props.hasSubdailyLayers) {
+ let date = this.props.draggerSelected === 'selectedB' ? this.props.dateB : this.props.date;
return (
<React.Fragment>
<DateInputColumn
step={1}
startDate={new Date(2000)}
today={new Date()}
- date={this.props.date}
+ date={date}
type="hour"
inputId={this.props.idSuffix ? 'hour-' + this.props.idSuffix : ''}
height={this.props.height}
width={this.props.width}
updateDate={this.updateDate.bind(this)}
- value={util.pad(this.props.date.getUTCHours(), 2, '0')}
+ value={util.pad(date.getUTCHours(), 2, '0')}
tabIndex={4}
focused={this.state.tab === 4}
setFocusedTab={this.setFocusedTab.bind(this)}
@@ -99,12 +84,12 @@ class DateSelector extends React.Component {
step={10}
startDate={new Date(2000)}
today={new Date()}
- date={this.props.date}
+ date={date}
type="minute"
height={this.props.height}
width={this.props.width}
updateDate={this.updateDate.bind(this)}
- value={util.pad(this.props.date.getUTCMinutes(), 2, '0')}
+ value={util.pad(date.getUTCMinutes(), 2, '0')}
inputId={this.props.idSuffix ? 'minute-' + this.props.idSuffix : ''}
tabIndex={5}
focused={this.state.tab === 5}
@@ -122,14 +107,15 @@ class DateSelector extends React.Component {
}
render() {
const {
- date,
width,
height,
maxDate,
minDate,
fontSize,
- idSuffix
+ idSuffix,
+ draggerSelected
} = this.props;
+ let date = draggerSelected === 'selectedB' ? this.props.dateB : this.props.date;
const tab = this.state;
return (
<div className="wv-date-selector-widget">
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index 3b1b1312c..cca45340c 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -92,13 +92,13 @@ class TimelineAxis extends React.Component {
}
//? how do position and transforms change between scale changes? lock into one line would be ideal
updateScale = (inputDate, timeScale, axisWidthInput, leftOffsetFixedCoeff, hoverChange) => {
- console.log(inputDate, timeScale, axisWidthInput, leftOffsetFixedCoeff, hoverChange)
+ // console.log(inputDate, timeScale, axisWidthInput, leftOffsetFixedCoeff, hoverChange)
let maxDateTEMP = moment.utc(new Date());
let options = timeScaleOptions[timeScale].timeAxis;
let gridWidth = options.gridWidth;
let axisWidth = axisWidthInput ? axisWidthInput : this.props.axisWidth;
let leftOffset = leftOffsetFixedCoeff ? axisWidth * leftOffsetFixedCoeff : this.state.leftOffset;
- console.log(this.state.leftOffset)
+
if (leftOffset === 0) {
leftOffset = axisWidth / 2;
}
diff --git a/web/js/components/timeline/timeline-controls/interval-timescale-change.js b/web/js/components/timeline/timeline-controls/interval-timescale-change.js
index e730e268e..974a44cfb 100644
--- a/web/js/components/timeline/timeline-controls/interval-timescale-change.js
+++ b/web/js/components/timeline/timeline-controls/interval-timescale-change.js
@@ -18,7 +18,6 @@ class TimeScaleIntervalChange extends Component {
}
handleClickZoom = (intervalSelected, openDialog) => {
- console.log(intervalSelected, openDialog)
// close tooltip
// send props function to change timescale zoom level throughout app
this.setState({
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 457672e80..607b149f0 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -19,7 +19,7 @@ import {
lastDate as layersLastDateTime
} from '../../modules/layers/selectors';
import { selectDate, changeTimeScale, selectInterval, changeCustomInterval } from '../../modules/date/actions';
-// import { selectDraggerState } from '../../modules/compare/actions';
+import { toggleActiveCompareState } from '../../modules/compare/actions';
import { onActivate as openAnimation, onClose as closeAnimation } from '../../modules/animation/actions';
import { timeScaleFromNumberKey, timeScaleToNumberKey } from '../../modules/date/constants';
import errorBoundary from '../error-boundary';
@@ -157,6 +157,11 @@ class Timeline extends React.Component {
});
}
+ // toggle selected dragger for comparison mode/focused date used in date selector
+ onChangeSelectedDragger = () => {
+ this.props.toggleActiveCompareState();
+ }
+
render() {
const {
dateFormatted,
@@ -239,8 +244,7 @@ class Timeline extends React.Component {
changeTimeScale={this.changeTimeScale}
compareModeActive={compareModeActive}
draggerSelected={draggerSelected}
- onChangeSelectedDragger={() => {
- }}
+ onChangeSelectedDragger={this.onChangeSelectedDragger.bind(this)}
timelineStartDateLimit={timelineStartDateLimit}
timelineEndDateLimit={timelineEndDateLimit}
updateAnimationRange={() => {
@@ -381,6 +385,9 @@ const mapDispatchToProps = dispatch => ({
closeAnimation: () => {
dispatch(closeAnimation());
},
+ toggleActiveCompareState: () => {
+ dispatch(toggleActiveCompareState());
+ }
// set currently selected delta - will always be 1 if !customSelected
// selectDelta: val => {
// dispatch(selectDelta(val));