Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Opacity control now has a label, and updates to control/label occurs when the model updates

Mike McGann83398cc292f5
diff --git a/etc/deploy/wv.css.json b/etc/deploy/wv.css.json
index 4f3dcbad4..adb87bda8 100644
--- a/etc/deploy/wv.css.json
+++ b/etc/deploy/wv.css.json
@@ -18,5 +18,6 @@
"src/css/dataDownload.css",
"src/css/global.css",
"src/css/wv.sidebar.css",
+ "src/css/wv.layers.options.css",
"src/css/new-ui.css"
]
diff --git a/src/css/wv.layers.options.css b/src/css/wv.layers.options.css
new file mode 100644
index 000000000..3d60056a3
--- /dev/null
+++ b/src/css/wv.layers.options.css
@@ -0,0 +1,15 @@
+/*
+ * NASA Worldview
+ *
+ * This code was originally developed at NASA/Goddard Space Flight Center for
+ * the Earth Science Data and Information System (ESDIS) project.
+ *
+ * Copyright (C) 2013 - 2014 United States Government as represented by the
+ * Administrator of the National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ */
+
+#wv-layers-options-dialog .wv-opacity-label {
+ width: 100%;
+ text-align: right;
+}
diff --git a/src/css/wv.sidebar.css b/src/css/wv.sidebar.css
index 707c2d82c..027193886 100644
--- a/src/css/wv.sidebar.css
+++ b/src/css/wv.sidebar.css
@@ -43,4 +43,3 @@
#productsHolder .ui-tabs-panel {
padding: 0;
}
-
diff --git a/src/index.html b/src/index.html
index 927a8a813..3f8a9c186 100644
--- a/src/index.html
+++ b/src/index.html
@@ -86,6 +86,7 @@
<!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/dataDownload.css">
<!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/global.css">
<!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/wv.sidebar.css">
+ <!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/wv.layers.options.css">
<!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/new-ui.css">
<link type="text/css" rel="Stylesheet" href="pages/css/wv.document.css">
diff --git a/src/js/layers/wv.layers.options.js b/src/js/layers/wv.layers.options.js
index 2a68f9387..50ff0d532 100644
--- a/src/js/layers/wv.layers.options.js
+++ b/src/js/layers/wv.layers.options.js
@@ -16,6 +16,7 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {
var alignTo = "#products";
var $dialog;
+ var $slider;
var $dropDown;
var self = {};
var canvas;
@@ -60,17 +61,20 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {
.on("dialogclose", dispose);
models.layers.events
- .on("remove", onLayerRemoved);
+ .on("remove", onLayerRemoved)
+ .on("opacity", onOpacityUpdate);
};
var dispose = function() {
-
+ models.layers.events
+ .off("remove", onLayerRemoved)
+ .off("opacity", onOpacityUpdate);
};
var renderOpacity = function($dialog) {
var $header = $("<div></div>")
.html("Opacity");
- var $slider = $("<div></div>")
+ $slider = $("<div></div>")
.noUiSlider({
start: layer.opacity,
step: 0.01,
@@ -95,6 +99,9 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {
}
var label = (opacity * 100).toFixed(0) + "%";
$("#wv-layers-options-dialog .wv-opacity-label").html(label);
+ if ( $slider.val() !== opacity ) {
+ $slider.val(opacity);
+ }
};
var renderRange = function($dialog) {