Interactive interface for browsing global, full-resolution satellite imagery
Small legend box when only one color
Mike McGann774da57ec0df
diff --git a/src/css/wv.palettes.css b/src/css/wv.palettes.cssindex c37556302..e14aa8a3d 100644--- a/src/css/wv.palettes.css+++ b/src/css/wv.palettes.css@@ -48,7 +48,14 @@width: 100%;height: 10px;border: 1px solid #404040;- cursor: pointer;+}++.bank div .editable {+ cursor: pointer;+}++.bank div .wv-palettes-colorbar[data-type='single'] {+ width: 10px;}/* FIXME: Too specific */@@ -60,3 +67,8 @@margin-bottom: 10px;}+.wv-palettes-type {+ font-size: 0.8em;+ margin-left: 5px;+}+diff --git a/src/js/palettes/wv.palettes.legend.js b/src/js/palettes/wv.palettes.legend.jsindex 89e4a2a35..ca6c1b7dd 100644--- a/src/js/palettes/wv.palettes.legend.js+++ b/src/js/palettes/wv.palettes.legend.js@@ -34,29 +34,39 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {.addClass("wv-palettes-panel");$colorbar = $("<canvas></canvas>").addClass("wv-palettes-colorbar");+$colorbarPanel.append($colorbar);+ if ( layer.palette.single ) {+ $colorbar.attr("data-type", "single");+ var $type = $("<span></span>")+ .addClass("wv-palettes-type");+ $colorbarPanel.append($type);+ }+$parent.append($colorbarPanel);- var $info = $("<table></table>")- .addClass("wv-palettes-info");- var $row = $("<tr></tr>");- var $min = $("<td></td>")- .addClass("wv-palettes-min")- .html(" ");- var $center = $("<td></td>")- .addClass("wv-palettes-center")- .html(" ");- var $max = $("<td></td>")- .addClass("wv-palettes-max")- .html(" ");-- $row.append($min).append($center).append($max);- $info.append($row);-- var $infoPanel = $("<div></div>")- .addClass("wv-palettes-panel");- $infoPanel.append($info);- $parent.append($infoPanel);+ if ( !layer.palette.single ) {+ var $info = $("<table></table>")+ .addClass("wv-palettes-info");+ var $row = $("<tr></tr>");+ var $min = $("<td></td>")+ .addClass("wv-palettes-min")+ .html(" ");+ var $center = $("<td></td>")+ .addClass("wv-palettes-center")+ .html(" ");+ var $max = $("<td></td>")+ .addClass("wv-palettes-max")+ .html(" ");++ $row.append($min).append($center).append($max);+ $info.append($row);++ var $infoPanel = $("<div></div>")+ .addClass("wv-palettes-panel");+ $infoPanel.append($info);+ $parent.append($infoPanel);+ }$colorbar.on("mousemove", function(event) {showUnitHover(event);@@ -65,7 +75,8 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {});if ( layer.type !== "wms" && !layer.palette.single ) {- $colorbar.on("click", showCustomSelector);+ $colorbar.on("click", showCustomSelector)+ .addClass("editable");}wv.palettes.colorbar(selector + " .wv-palettes-colorbar");model.events@@ -94,7 +105,7 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {}var palette = model.forLayer(layer.id);if (layer.palette.single) {- $(selector + " .wv-palettes-center").html(palette.values[0]);+ $(selector + " .wv-palettes-type").html(palette.values[0]);} else if (layer.palette.classified) {$(selector + " .wv-palettes-center").html("Classes");} else {