Interactive interface for browsing global, full-resolution satellite imagery
WV-234: Data value shown on legend hover
Mike McGannb9af359161e8
diff --git a/src/css/wv.palettes.css b/src/css/wv.palettes.cssindex 968658e3e..15f091536 100644--- a/src/css/wv.palettes.css+++ b/src/css/wv.palettes.css@@ -96,3 +96,8 @@margin-left: 5px;}+.wv-palettes-color-box {+ border: 1px solid black;+ margin-right: 10px;+ padding: 2px 8px 2px 8px;+}diff --git a/src/js/image/wv.image.rubberband.js b/src/js/image/wv.image.rubberband.jsindex 16268612c..a3ce8e6e9 100644--- a/src/js/image/wv.image.rubberband.js+++ b/src/js/image/wv.image.rubberband.js@@ -82,7 +82,7 @@ wv.image.rubberband = wv.image.rubberband || function(models, config) {$(".ui-dialog").on("dialogclose", function() {if ( state === "on" ) {toggle();- };+ }});draw();};diff --git a/src/js/palettes/wv.palettes.legend.js b/src/js/palettes/wv.palettes.legend.jsindex a38fb77ff..489bb2c2d 100644--- a/src/js/palettes/wv.palettes.legend.js+++ b/src/js/palettes/wv.palettes.legend.js@@ -33,7 +33,8 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {var $colorbarPanel = $("<div></div>").addClass("wv-palettes-panel");$colorbar = $("<canvas></canvas>")- .addClass("wv-palettes-colorbar");+ .addClass("wv-palettes-colorbar")+ .attr("title", "X");$colorbarPanel.append($colorbar);if ( layer.palette.single ) {@@ -68,15 +69,19 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {$parent.append($infoPanel);}- $colorbar.on("mousemove", function(event) {- showUnitHover(event);- }).on("mouseout", function() {- showUnitRange();- });-- if ( layer.type !== "wms" && !layer.palette.single ) {+ if ( layer.palette && layer.type !== "wms" && !layer.palette.single ) {$colorbar.on("click", showCustomSelector).addClass("editable");+ $colorbar.on("mousemove", function(event) {+ showUnitHover(event);+ });+ $colorbar.tooltip({+ position: {+ my: "left middle",+ at: "right+15 middle",+ of: $colorbar+ }+ });}wv.palettes.colorbar(selector + " .wv-palettes-colorbar");model.events@@ -120,7 +125,7 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {};var showUnitHover = function(event) {- if ( !loaded || !layer.palette.classified ) {+ if ( !loaded ) {return;}var palette = model.forLayer(layer.id);@@ -129,12 +134,13 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {var percent = x / width;var bins = palette.values.length;var index = Math.floor(bins * percent);- if (index > bins) {- index = bins;+ if (index >= bins) {+ index = bins - 1;}- $(selector + " .wv-palettes-min").html(" ");- $(selector + " .wv-palettes-max").html(" ");- $(selector + " .wv-palettes-center").html(palette.values[index]);++ $colorbar.tooltip("option", "content",+ "<span class='wv-palettes-color-box' style='background: #" ++ palette.colors[index] + "'>" + "</span>" + palette.values[index]);};var showCustomSelector = function(event) {diff --git a/src/js/ui/wv.ui.js b/src/js/ui/wv.ui.jsindex b33f33e1d..29b066de4 100644--- a/src/js/ui/wv.ui.js+++ b/src/js/ui/wv.ui.js@@ -62,7 +62,7 @@ wv.ui = (function(self) {*/self.notify = function(message, title) {var $dialog = self.getDialog();- var title = title || "Notice";+ title = title || "Notice";$dialog.html(message).dialog({title: title,show: { effect: "fade" },diff --git a/src/js/wv.main.js b/src/js/wv.main.jsindex fdca7fef6..8fe0f98ed 100644--- a/src/js/wv.main.js+++ b/src/js/wv.main.js@@ -51,7 +51,7 @@ $(function() {];if ( config.features.dataDownload ) {parsers.push(wv.data.parse);- };+ }_.each(parsers, function(parser) {parser(state, errors, config);