Interactive interface for browsing global, full-resolution satellite imagery
add comments #375
Benjamin King386b0f9a5681
diff --git a/web/js/components/layer/settings/palette.js b/web/js/components/layer/settings/palette.jsindex 5455f8725..0d8dca83a 100644--- a/web/js/components/layer/settings/palette.js+++ b/web/js/components/layer/settings/palette.js@@ -12,6 +12,9 @@ class OpacitySelect extends React.Component {activePalette: props.activePalette};}+ /**+ * Render default legend option+ */renderDefault() {const { layer, index, getDefaultLegend } = this.props;const { activePalette } = this.state;@@ -32,9 +35,16 @@ class OpacitySelect extends React.Component {);}}+ /**+ * Pass palette to model after selection+ * @param {String} id | custom Palette Id+ */onChangePalette(id) {const { layer, clearCustom, setCustom, index } = this.props;+ // Applying customs takes a while and+ // it looks more natural to make this async+ // instead of waitingsetTimeout(function() {if (id === '__default') {clearCustom(layer.id, index);@@ -44,6 +54,10 @@ class OpacitySelect extends React.Component {}, 0);this.setState({ activePalette: id });}+ /**+ * Apply logic to render correct palette selection+ * @param {String} id | Legend Id+ */customLegend(id) {const {getDefaultLegend,@@ -79,6 +93,13 @@ class OpacitySelect extends React.Component {);}}+ /**+ * Render customs palette options+ * @param {Object} palette | Palette object+ * @param {String} id | colormap Id+ * @param {Object} legend | Legend Object+ * @param {Boolean} isSelected | is this colormap active+ */renderSelectorItemScale(palette, id, legend, isSelected) {const { canvas, checkerBoard } = this.props;const caseDefaultClassName =@@ -107,6 +128,14 @@ class OpacitySelect extends React.Component {</div>);}+ /**+ * Render classification customs when there is only one+ * Color in colormap+ * @param {Object} palette | Palette object+ * @param {String} id | colormap Id+ * @param {String} description | Colormap name+ * @param {Boolean} isSelected | is this colormap active+ */renderSelectorItemSingle(palette, id, description, isSelected) {const color = palette.classes? palette.classes.colors[0]diff --git a/web/js/components/layer/settings/settings.js b/web/js/components/layer/settings/settings.jsindex 56b9e5f8f..7ce1913bf 100644--- a/web/js/components/layer/settings/settings.js+++ b/web/js/components/layer/settings/settings.js@@ -27,6 +27,10 @@ class LayerSettings extends React.Component {title: props.title};}+ /**+ * Render multicolormap layers inside a tab pane+ * @param {object} legends | legend object+ */renderMultiColormapCustoms(legends) {const {clearCustom,@@ -116,6 +120,9 @@ class LayerSettings extends React.Component {</React.Fragment>);}+ /**+ * Render Opacity, threshold, and custom palette options+ */renderCustoms() {const {setCustom,diff --git a/web/js/components/layer/settings/threshold.js b/web/js/components/layer/settings/threshold.jsindex 58a5bbfb7..34848f101 100644--- a/web/js/components/layer/settings/threshold.js+++ b/web/js/components/layer/settings/threshold.js@@ -15,6 +15,10 @@ class ThresholdSelect extends React.Component {};this.debounceSetRange = lodashDebounce(props.setRange, 300);}+ /**+ * Apply squash+ * @param {Boolean} boo+ */updateSquash(boo) {const { setRange, layerId, index } = this.props;const { start, end, squashed } = this.state;@@ -22,6 +26,10 @@ class ThresholdSelect extends React.Component {setRange(layerId, parseFloat(start), parseFloat(end), isSquashed, index);this.setState({ squashed: isSquashed });}+ /**+ * Update threshold values+ * @param {Array} thresholdArray | Array of start/end indexs for colormap+ */updateThreshold(thresholdArray) {const { layerId, index } = this.props;const { start, end } = this.state;@@ -44,6 +52,7 @@ class ThresholdSelect extends React.Component {} else {return;}+ // Update local state on every range-selector change but debounce threshold model updatethis.debounceSetRange(layerId,parseFloat(newStart),diff --git a/web/js/layers/options.js b/web/js/layers/options.jsindex cf562420f..c957902f5 100644--- a/web/js/layers/options.js+++ b/web/js/layers/options.js@@ -25,6 +25,10 @@ export function layersOptions(models, ui, config) {self.reactComponent.setState({ isOpen: false });self.layerId = null;};+ /**+ * Open react component with new layer info+ * @param {Object} layer | Active layer object+ */self.createNewLayer = function(layer) {if (layer.id === self.layerId) {return self.close();@@ -38,7 +42,10 @@ export function layersOptions(models, ui, config) {isOpen: true});};- var loaded = function(custom) {+ /**+ * Mount component once customs Config is loaded+ */+ var loaded = function() {self.reactComponent = render(<LayerSettingssetCustom={models.palettes.setCustom}