Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Toggle compare state on dragger click #1182

Benjamin King2381639371b4
diff --git a/web/js/components/range-selection/dragger.js b/web/js/components/range-selection/dragger.js
index cef995339..7e9b9258a 100644
--- a/web/js/components/range-selection/dragger.js
+++ b/web/js/components/range-selection/dragger.js
@@ -95,6 +95,9 @@ class TimelineDragger extends React.Component {
visibility: visibility
}}
d={this.props.path}
+ onMouseDown={() => {
+ this.props.onMouseDown(this.props.id);
+ }}
transform={
'translate(' +
-this.props.width / 2 +
@@ -209,7 +212,8 @@ TimelineDragger.propTypes = {
yOffset: PropTypes.number,
path: PropTypes.string,
textColor: PropTypes.string,
- text: PropTypes.string
+ text: PropTypes.string,
+ onMouseDown: PropTypes.func
};
export default TimelineDragger;
diff --git a/web/js/date/compare-picks.js b/web/js/date/compare-picks.js
index a5150c563..9d570cb23 100644
--- a/web/js/date/compare-picks.js
+++ b/web/js/date/compare-picks.js
@@ -94,6 +94,7 @@ export function timelineCompare(models, config, ui) {
},
yOffset: 15,
path: PICK_PATH,
+ onMouseDown: onMouseDown,
height: 59.51,
width: 58.42,
textColor: null,
@@ -106,6 +107,11 @@ export function timelineCompare(models, config, ui) {
text: label
};
};
+ var onMouseDown = function(id) {
+ if (models.date.activeDate !== id) {
+ models.compare.toggleState();
+ }
+ };
var updateState = function() {
self.comparePickA.setState({
position: getLocationFromStringDate(models.date['selected'])