Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Decision was made to use clipping instead of stretching on the adjustable thresholds. Also, the color legend will shrink and show a transparent checkerboard behind (which has been lightened)

Mike McGann75d0de93c104
diff --git a/src/js/layers/wv.layers.options.js b/src/js/layers/wv.layers.options.js
index 6aa468471..1d8070549 100644
--- a/src/js/layers/wv.layers.options.js
+++ b/src/js/layers/wv.layers.options.js
@@ -160,8 +160,8 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {
var active = models.palettes.get(layerId);
var rendered = config.palettes.rendered[layerDef.palette.id];
- var min = min || active.min || 0;
- var max = max || active.max || rendered.scale.colors.length;
+ min = min || active.min || 0;
+ max = max || active.max || rendered.scale.colors.length;
var minLabel = rendered.scale.labels[min];
var maxLabel = rendered.scale.labels[max];
@@ -170,7 +170,7 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {
if ( !_.isEqual($range.val(), [min, max]) ) {
$range.val([min, max]);
- };
+ }
};
var renderPaletteSelector = function($dialog) {
diff --git a/src/js/palettes/wv.palettes.js b/src/js/palettes/wv.palettes.js
index 57e4cc0b3..202db89af 100644
--- a/src/js/palettes/wv.palettes.js
+++ b/src/js/palettes/wv.palettes.js
@@ -70,11 +70,13 @@ wv.palettes = (function(self) {
var g = canvas.getContext("2d");
- g.fillStyle = "rgb(102, 102, 102)";
+ //g.fillStyle = "rgb(102, 102, 102)";
+ g.fillStyle = "rgb(200, 200, 200)";
g.fillRect(0, 0, size, size);
g.fillRect(size, size, size, size);
- g.fillStyle = "rgb(153, 153, 153)";
+ //g.fillStyle = "rgb(153, 153, 153)";
+ g.fillStyle = "rgb(240, 240, 240)";
g.fillRect(0, size, size, size);
g.fillRect(size, 0, size, size);
diff --git a/src/js/palettes/wv.palettes.model.js b/src/js/palettes/wv.palettes.model.js
index 4744475bb..39bd3e131 100644
--- a/src/js/palettes/wv.palettes.model.js
+++ b/src/js/palettes/wv.palettes.model.js
@@ -152,6 +152,9 @@ wv.palettes.model = wv.palettes.model || function(models, config) {
target = source.scale;
}
+ var min = def.min || 0;
+ var max = def.max || source.scale.colors.length;
+
var sourceCount = source.scale.colors.length;
var targetCount = target.colors.length;
@@ -159,19 +162,18 @@ wv.palettes.model = wv.palettes.model || function(models, config) {
"id": target.id,
"name": target.name || undefined
};
- var newColors = [];
+
var newScale = [];
var newLabels = [];
_.each(source.scale.colors, function(color, index) {
if ( index < def.min || index > def.max ) {
- newColors.push("00000000");
+ newScale.push("00000000");
} else {
var sourcePercent = index / sourceCount;
- var targetIndex = Math.floor(sourcePercent * targetCount);
- newColors.push(target.colors[targetIndex]);
+ var targetIndex = Math.floor(sourcePercent * (targetCount - 1));
newScale.push(target.colors[targetIndex]);
- newLabels.push(source.scale.labels[targetIndex]);
}
+ newLabels.push(source.scale.labels[index]);
});
scale.colors = newScale;
scale.labels = newLabels;
@@ -184,7 +186,7 @@ wv.palettes.model = wv.palettes.model || function(models, config) {
parseInt(sourceColor.substring(2, 4), 16) + "," +
parseInt(sourceColor.substring(4, 6), 16) + "," +
parseInt(sourceColor.substring(6, 8), 16);
- var targetColor = newColors[index];
+ var targetColor = newScale[index];
var targetEntry = {
r: parseInt(targetColor.substring(0, 2), 16),
g: parseInt(targetColor.substring(2, 4), 16),