Interactive interface for browsing global, full-resolution satellite imagery
WV-944: If options panel is open and it is reselected, close. If options panel is open and another panel is requested, open that panel. Fixed bug where the options would sometimes not open
Mike McGann9bfbed9f90cf
diff --git a/web/js/layers/wv.layers.active.js b/web/js/layers/wv.layers.active.jsindex 02ee88b84..c726b14d6 100644--- a/web/js/layers/wv.layers.active.js+++ b/web/js/layers/wv.layers.active.js@@ -202,11 +202,8 @@ wv.layers.active = wv.layers.active || function(models, ui, config) {var names = models.layers.getTitles(layer.id);var mainLayerDiv = $('<div></div>').addClass('layer-main')- .toggle(function() {- wv.layers.options(config, models, layer);- },function(){- wv.ui.closeDialog('wv-layers-options-dialog');- })+ .attr("data-layer", layer.id)+ .click(toggleOptionsPanel).append($('<h4></h4>').html(names.title)).append($('<p></p>').html(names.subtitle));@@ -222,6 +219,20 @@ wv.layers.active = wv.layers.active || function(models, ui, config) {}};+ var toggleOptionsPanel = function() {+ var $d = $("#wv-layers-options-dialog");+ var thisLayerId = $(this).attr("data-layer");+ var thisLayer = config.layers[thisLayerId];+ if ( $d.length === 0 ) {+ wv.layers.options(config, models, thisLayer);+ } else if ( $d.attr("data-layer") !== thisLayerId ) {+ wv.ui.closeDialog();+ wv.layers.options(config, models, thisLayer);+ } else {+ wv.ui.closeDialog();+ }+ };+var renderLegend = function($parent, group, layer) {var $container = $("<div></div>").addClass("wv-palette")diff --git a/web/js/layers/wv.layers.options.js b/web/js/layers/wv.layers.options.jsindex e87566a55..d1e377ae9 100644--- a/web/js/layers/wv.layers.options.js+++ b/web/js/layers/wv.layers.options.js@@ -36,7 +36,9 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {var loaded = function(custom) {$dialog = wv.ui.getDialog();- $dialog.attr("id", "wv-layers-options-dialog");+ $dialog+ .attr("id", "wv-layers-options-dialog")+ .attr("data-layer", layer.id);renderOpacity($dialog);if ( config.features.customPalettes ) {