Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Prevent dragging off of timeline #1182

Benjamin King6b1e432abde7
diff --git a/web/js/components/range-selection/dragger.js b/web/js/components/range-selection/dragger.js
index 9491a3d0f..84a4c81c6 100644
--- a/web/js/components/range-selection/dragger.js
+++ b/web/js/components/range-selection/dragger.js
@@ -153,6 +153,7 @@ class TimelineDragger extends React.Component {
*/
handleDrag(e, d) {
e.stopPropagation();
+ e.preventDefault();
var position = this.state.position + e.movementX;
this.props.onDrag(d.deltaX, this.props.id, d.x);
this.setState({ position: position });
diff --git a/web/js/date/compare-picks.js b/web/js/date/compare-picks.js
index 8cf7bc158..f8f082c7a 100644
--- a/web/js/date/compare-picks.js
+++ b/web/js/date/compare-picks.js
@@ -89,7 +89,9 @@ export function timelineCompare(models, config, ui) {
onDrag: (e, id, position) => {
self.events.trigger('drag', e, id, position);
},
+
onStop: (id, position) => {
+ self.dragging = false;
self.events.trigger('drag-end', null, id, position);
},
yOffset: 15,
@@ -135,9 +137,9 @@ export function timelineCompare(models, config, ui) {
};
var dateSelect = function(e, id, offsetX) {
var position = offsetX;
- if (position > max) {
- position = max - 10;
- } else if (position <= 0) {
+ if (position > max - 5) {
+ position = max - 5;
+ } else if (position <= 5) {
position = 5;
}
var date = timeline.x.invert(position);
@@ -160,13 +162,14 @@ export function timelineCompare(models, config, ui) {
*
*/
var showPickHoverDate = function(e, id, offsetX) {
- if (offsetX < max && offsetX > 0) {
+ if (offsetX < max - 5 && offsetX > 5) {
let date = timeline.x.invert(offsetX);
ui.timeline.pick.hoverDate(date, true);
}
};
var removeTicks = function() {
ui.timeline.ticks.label.remove();
+ updateState();
};
init();
return self;