Interactive interface for browsing global, full-resolution satellite imagery
Make marker drag detection more robust
Josiah Sprague592c50690142
diff --git a/web/js/naturalEvents/wv.naturalEvents.markers.js b/web/js/naturalEvents/wv.naturalEvents.markers.jsindex 6701b20c4..b372d0fcb 100644--- a/web/js/naturalEvents/wv.naturalEvents.markers.js+++ b/web/js/naturalEvents/wv.naturalEvents.markers.js@@ -59,20 +59,29 @@ wv.naturalEvents.markers = wv.naturalEvents.markers || function(models, ui) {// Add event listenersvar willSelect = true;+ var moveCount = 0;var pinEl = marker.pin.element_;['pointerdown', 'mousedown', 'touchstart'].forEach(function(type){pinEl.addEventListener(type, function(e){willSelect = true;+ moveCount = 0;passEventToTarget(e, olViewport);});});['pointermove', 'wheel', 'pointerdrag','pointerup', 'mousemove', 'touchmove'].forEach(function(type){pinEl.addEventListener(type, function(e){- if (type === 'pointermove' || type === 'wheel') willSelect = false;passEventToTarget(e, olViewport);});});+ ['pointermove', 'mousemove'].forEach(function(type){+ pinEl.addEventListener(type, function(e){+ moveCount++;+ if (moveCount > 2) {+ willSelect = false;+ }+ });+ });pinEl.addEventListener('click', function(e){if (willSelect && !isSelected) {ui.naturalEvents.selectEvent(event.id,date);