Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Refactoring for data runners throttle conditions

Paco Dupont904905abfa6d
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index 912614745..6dd3f732d 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -875,16 +875,15 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
if (self.mapIsbeingDragged || wv.util.browser.small) {
return;
}
- if ((typeof models.naturalEvents != 'undefined' &&
- models.naturalEvents.active) ||
- (typeof models.data != 'undefined' && models.data.active)) {
- return;
- }
- if (models.anim) {
- if (models.anim.rangeState.playing) {
- return; // don't get running data if map is animating
- }
- }
+
+ // Don't add data runners if we're on the events or data tabs
+ var isEventsTabActive = (typeof models.naturalEvents !== 'undefined' && models.naturalEvents.active);
+ var isDataTabActive = (typeof models.data !== 'undefined' && models.data.active);
+ // Don't add data runners if map is animating
+ var isMapAnimating = (typeof models.anim !== 'undefined' && models.anim.rangeState.playing)
+
+ if (isEventsTabActive || isDataTabActive || isMapAnimating) return;
+
dataRunner.newPoint(pixels, map);
}
$(map.getViewport())