Interactive interface for browsing global, full-resolution satellite imagery
Visiblity turned off once map moves
Mike McGann16924a879820
diff --git a/js/Worldview/Map.js b/js/Worldview/Map.jsindex 3234efd04..7551c9ca9 100644--- a/js/Worldview/Map.js+++ b/js/Worldview/Map.js@@ -120,6 +120,9 @@ $(function(ns) {ns.setVisibility = function(layer, visible, opacity) {var actualOpacity = ( visible ) ? opacity : 0;layer.div.style.opacity = actualOpacity;+ if ( visible && opacity > 0 && !layer.getVisibility() ) {+ layer.setVisibility(true);+ }}}(Worldview.Map));diff --git a/js/Worldview/Map/DailyProduct.js b/js/Worldview/Map/DailyProduct.jsindex 705b162d2..af6239c43 100644--- a/js/Worldview/Map/DailyProduct.js+++ b/js/Worldview/Map/DailyProduct.js@@ -71,9 +71,9 @@ Worldview.Map.DailyProduct = function(map, config) {var init = function() {self.setDay(Worldview.today());- map.events.register("movestart", self, clearCache);- map.events.register("zoomend", self, clearCache);- $(window).resize(clearCache);+ map.events.register("movestart", self, invalidate);+ map.events.register("zoomend", self, invalidate);+ $(window).resize(invalidate);};/**@@ -149,7 +149,7 @@ Worldview.Map.DailyProduct = function(map, config) {reset();fetchLayer();} else {- clearCache();+ invalidate();currentLayer.lookupTable = lookup;applyLookup(currentLayer);}@@ -194,9 +194,9 @@ Worldview.Map.DailyProduct = function(map, config) {if ( reaperId !== null ) {clearTimeout(reaperId);}- map.events.unregister("movestart", self, clearCache);- map.events.unregister("zoomend", self, clearCache);- $(window).unbind("resize", clearCache);+ map.events.unregister("movestart", self, invalidate);+ map.events.unregister("zoomend", self, invalidate);+ $(window).unbind("resize", invalidate);};//-------------------------------------------------------------------------@@ -264,7 +264,7 @@ Worldview.Map.DailyProduct = function(map, config) {* between a lookup and non-lookup based layer.*/var reset = function() {- clearCache();+ invalidate();if ( currentLayer ) {map.removeLayer(currentLayer);}@@ -275,7 +275,14 @@ Worldview.Map.DailyProduct = function(map, config) {* Hide all layers that are not currently being displayed and move them* to the stale set. Restart the reaper to remove those layers.*/- var clearCache = function() {+ var invalidate = function() {+ if ( currentLayer ) {+ console.log("move", currentLayer, currentLayer.div.style.opacity);+ if ( currentLayer.div.style.opacity < 0.001 ) {+ console.log("hiding", currentLayer);+ currentLayer.setVisibility(false);+ }+ }if ( $.isEmptyObject(cachedLayers) ) {return;}