Interactive interface for browsing global, full-resolution satellite imagery
Fix layer sidebar info button errors and option button errors - Fix layersInfo import naming preventing info window from opening - Fix layersOptions import naming preventing config window from opening - Fix `$colorBox is not defined` error in palettes/legend.js - Fix `palette is not defined` in palettes/model.js - Fix `ReferenceError: oldLegend is not defined` in palettes/model.js - Fix `cannot call methods on dialog prior to initialization; attempted to call method 'close'` error when attempting to use options button to open options dialog after info dialog is open; or vice-versa
ZachTRicebb5d309bef48
diff --git a/web/js/layers/active.js b/web/js/layers/active.jsindex 2e083e0a2..fb60cd02d 100644--- a/web/js/layers/active.js+++ b/web/js/layers/active.js@@ -8,8 +8,8 @@ import loEach from 'lodash/each';import loEachRight from 'lodash/eachRight';import util from '../util/util';import wvui from '../ui/ui';-import layersInfo from './info';-import layersOptions from './options';+import {layersInfo} from './info';+import {layersOptions} from './options';import {palettesLegend} from '../palettes/legend';export function layersActive(models, ui, config) {diff --git a/web/js/layers/options.js b/web/js/layers/options.jsindex 80fd53421..0ab424d42 100644--- a/web/js/layers/options.js+++ b/web/js/layers/options.js@@ -273,6 +273,7 @@ export function layersOptions(config, models, layer) {};var onRangeUpdate = function () {+ var current;updateRangeLabels();var palette = models.palettes.get(layer.id, index);diff --git a/web/js/palettes/legend.js b/web/js/palettes/legend.jsindex 606e97f79..81ba9cd42 100644--- a/web/js/palettes/legend.js+++ b/web/js/palettes/legend.js@@ -117,10 +117,10 @@ export function palettesLegend(spec) {};var updateClasses = function (legend, index) {+ var $colorBox;var $panel = $(selector + ' [data-index=\'' + index + '\']');$panel.empty();loEach(legend.colors, function (color, classIndex) {- var $colorBox;var $runningDataPointLabel = $('<span></span>').addClass('wv-running-category-label');$colorBox = $('<span></span>')diff --git a/web/js/palettes/model.js b/web/js/palettes/model.jsindex 43f1ac238..47f900ff4 100644--- a/web/js/palettes/model.js+++ b/web/js/palettes/model.js@@ -27,6 +27,7 @@ export function palettesModel(models, config) {};self.getCustom = function (paletteId) {+ var palette;palette = config.palettes.custom[paletteId];if (!palette) {throw new Error('Invalid palette: ' + paletteId);@@ -346,7 +347,7 @@ export function palettesModel(models, config) {loEach(state.l, function (layerDef) {var layerId = layerDef.id;- var minValue, maxValue;+ var values, minValue, maxValue;var min = [],max = [];var squash = [];@@ -479,12 +480,13 @@ export function palettesModel(models, config) {};var updateLookup = function (layerId) {+ var legend, oldLegend, entries;+ var lookup = {};if (!useLookup(layerId)) {delete self.active[layerId];return;}var active = self.active[layerId].maps;- var lookup = {};loEach(active, function (palette, index) {oldLegend = palette.legend;entries = palette.entries;@@ -499,7 +501,6 @@ export function palettesModel(models, config) {id: oldLegend.id};var source = entries.colors;- var values = entries.values;var target = (palette.custom)? self.getCustom(palette.custom).colors : source;@@ -509,17 +510,16 @@ export function palettesModel(models, config) {var sourceCount = source.length;var targetCount = target.length;- var indexCount = max - min;loEach(source, function (color, index) {- var newColor;+ var targetColor;if (index < min || index > max) {targetColor = '00000000';} else {var sourcePercent, targetIndex;if (palette.squash) {sourcePercent = (index - min) / (max - min);- if (index == max) {+ if (index === max) {sourcePercent = 1.0;}targetIndex = Math.floor(sourcePercent * targetCount);