Interactive interface for browsing global, full-resolution satellite imagery
Fixed bug where palettes were not being reset after imagedownload when two or more palettes were selected
Mike McGannbdd31d7ec685
diff --git a/js/Worldview/Map/ProductMap.js b/js/Worldview/Map/ProductMap.jsindex 9a14fe1d5..6e2decb7c 100644--- a/js/Worldview/Map/ProductMap.js+++ b/js/Worldview/Map/ProductMap.js@@ -241,16 +241,17 @@ Worldview.Map.ProductMap = function(containerId, mapConfig, component) {* and palette names as values.*/self.setPalettes = function(activePalettes) {+ console.log(activePalettes);$.each(activeMaps, function(projection, map) {- $.each(map.products, function(name, product) {- if ( name in activePalettes ) {+ $.each(map.products, function(productName, product) {+ var paletteName = activePalettes[productName];+ if ( paletteName ) {// Find the rendered palette for this product- var productConfig = self.mapConfig.products[name];+ var productConfig = self.mapConfig.products[productName];var renderedName = productConfig.rendered;var renderedPalette = self.mapConfig.palettes[renderedName];// Find the palette that should be used instead- var paletteName = activePalettes[name];var palette = self.mapConfig.palettes[paletteName];// Create a lookup table and map it to the colordiff --git a/js/Worldview/Support.js b/js/Worldview/Support.jsindex cfaba7ddf..3fefdc1a8 100644--- a/js/Worldview/Support.js+++ b/js/Worldview/Support.js@@ -47,6 +47,11 @@ Worldview.namespace("Support");"browser. Upgrade or try again in a different browser.")};+ ns.quirks = function() {+ jQueryLayerFix();+ shimFreeze();+ };+var init = function() {if ( / Safari\//.test(navigator.userAgent) ) {ns.BROWSER = "Safari";@@ -56,7 +61,37 @@ Worldview.namespace("Support");}}};-++ /*+ * jQuery version 1.6 causes thousands of warnings to be emitted to the+ * console on WebKit based browsers with the following message:+ *+ * event.layerX and event.layerY are broken and deprecated in WebKit. They+ * will be removed from the engine in the near future.+ *+ * This has been fixed in jQuery 1.8 but Worldview currently doesn't+ * support that version. This fix copied from:+ *+ * http://stackoverflow.com/questions/7825448/webkit-issues-with-event-layerx-and-event-layery+ */+ var jQueryLayerFix = function() {+ // remove layerX and layerY+ var all = $.event.props,+ len = all.length,+ res = [];+ while (len--) {+ var el = all[len];+ if (el != 'layerX' && el != 'layerY') res.push(el);+ }+ $.event.props = res;+ };++ var shimFreeze = function() {+ if ( !Object.freeze ) {+ Object.freeze = function() {}+ }+ };+init();})(Worldview.Support);diff --git a/js/Worldview/Widget/Palette.js b/js/Worldview/Widget/Palette.jsindex 91a0bd70d..2d1eb4c9f 100644--- a/js/Worldview/Widget/Palette.js+++ b/js/Worldview/Widget/Palette.js@@ -52,7 +52,7 @@ Worldview.Widget.Palette = function(containerId, config, spec) {self.active = {};var parts = v.split("~");$.each(parts, function(index, part) {- var segments = v.split(",");+ var segments = part.split(",");self.active[segments[0]] = segments[1];});REGISTRY.fire(self);diff --git a/js/main.js b/js/main.jsindex 47120fa8a..9082c819c 100644--- a/js/main.js+++ b/js/main.js@@ -97,7 +97,7 @@ $(function() {// Initialize "static" varsvar onConfigLoad = function(config) {try {- init(config);+ init(Object.freeze(config));} catch ( error ) {Worldview.error("Unable to start Worldview", error);}@@ -107,32 +107,10 @@ $(function() {// Initialize "static" varsWorldview.error("Unable to load configuration from server", message);};- /*- * jQuery version 1.6 causes thousands of warnings to be emitted to the- * console on WebKit based browsers with the following message:- *- * event.layerX and event.layerY are broken and deprecated in WebKit. They- * will be removed from the engine in the near future.- *- * This has been fixed in jQuery 1.8 but Worldview currently doesn't- * support that version. This fix copied from:- *- * http://stackoverflow.com/questions/7825448/webkit-issues-with-event-layerx-and-event-layery- */- var jQueryLayerFix = function() {- // remove layerX and layerY- var all = $.event.props,- len = all.length,- res = [];- while (len--) {- var el = all[len];- if (el != 'layerX' && el != 'layerY') res.push(el);- }- $.event.props = res;- };+try {- jQueryLayerFix();+ Worldview.Support.quirks();entryPoint();} catch ( cause ) {Worldview.error("Failed to start Worldview", cause);