Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix code styling

Benjamin Kingb1326a8e4add
diff --git a/web/css/switch.css b/web/css/switch.css
index 9381639bd..77542730c 100644
--- a/web/css/switch.css
+++ b/web/css/switch.css
@@ -5,20 +5,13 @@
.react-switch .switch-col {
align-items: flex-start;
display: flex;
- align-items: flex-start;
}
.react-switch-case {
- /* width: 30px;
- display: inline-block;
- position: relative; */
- width: 20%;
- align-items: flex-start;
+ width: 20%;
+ align-items: flex-start;
}
.react-switch-label-case {
- /* width: 30px;
- display: inline-block;
- position: relative; */
- width: 80%;
+ width: 80%;
}
.react-switch-checkbox {
height: 0;
@@ -27,35 +20,35 @@
}
.react-switch-label {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- cursor: pointer;
- width: 30px;
- height: 15px;
- background: grey;
- border-radius: 30px;
- position: relative;
- transition: background-color .2s;
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ cursor: pointer;
+ width: 30px;
+ height: 15px;
+ background: rgb(128, 128, 128);
+ border-radius: 30px;
+ position: relative;
+ transition: background-color 0.2s;
}
.react-switch-label .react-switch-button {
- content: '';
- position: absolute;
- left: 2px;
- width: 15px;
- height: 15px;
- border-radius: 15px;
- transition: 0.2s;
- background: #fff;
- box-shadow: 0 0 2px 0 rgba(10, 10, 10, 0.29);
+ content: '';
+ position: absolute;
+ left: 2px;
+ width: 15px;
+ height: 15px;
+ border-radius: 15px;
+ transition: 0.2s;
+ background: #fff;
+ box-shadow: 0 0 2px 0 rgba(10, 10, 10, 0.29);
}
.react-switch-checkbox:checked + .react-switch-label .react-switch-button {
- left: calc(100% - 2px);
- transform: translateX(-100%);
+ left: calc(100% - 2px);
+ transform: translateX(-100%);
}
.react-switch-label:active .react-switch-button {
- width: 60px;
-}
\ No newline at end of file
+ width: 60px;
+}
diff --git a/web/css/util.css b/web/css/util.css
index 47a039a1d..bdeed2634 100644
--- a/web/css/util.css
+++ b/web/css/util.css
@@ -213,5 +213,5 @@ button[data-tooltip] {
.checker-board-pattern {
background-image: linear-gradient(45deg, #808080 25%, transparent 25%), linear-gradient(-45deg, #808080 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #808080 75%), linear-gradient(-45deg, transparent 75%, #808080 75%);
background-size: 5px 5px;
- background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
-}
\ No newline at end of file
+ background-position: 0 0, 0 10px, 10px -10px, -10px 0;
+}
diff --git a/web/js/components/layer/settings/classification-toggle.js b/web/js/components/layer/settings/classification-toggle.js
index e74ce15f8..43dd7147c 100644
--- a/web/js/components/layer/settings/classification-toggle.js
+++ b/web/js/components/layer/settings/classification-toggle.js
@@ -11,11 +11,11 @@ class ClassificationToggle extends React.Component {
active: props.active
};
}
+
render() {
const { legend, toggle } = this.props;
const tooltips = legend.tooltips;
-
return (
<div className="layer-classification-toggle settings-component">
<h2 className="wv-header">Category Enable/Disable</h2>
@@ -38,7 +38,6 @@ class ClassificationToggle extends React.Component {
</Scrollbar>
</div>
);
-
}
}
ClassificationToggle.defaultProps = {
diff --git a/web/js/components/layer/settings/settings.js b/web/js/components/layer/settings/settings.js
index 0fd1607e9..a2f356c25 100644
--- a/web/js/components/layer/settings/settings.js
+++ b/web/js/components/layer/settings/settings.js
@@ -66,7 +66,8 @@ class LayerSettings extends React.Component {
palettesTranslate,
groupName,
setThresholdRange,
- layer
+ layer,
+ toggleClassification
} = this.props;
const { activeIndex } = this.state;
const navElements = [];
@@ -119,6 +120,10 @@ class LayerSettings extends React.Component {
/>
) : null
}
+ {(legend.type === 'classification' && legend.colors.length > 1) ? (
+ <ClassificationToggle toggle={(classIndex) => toggleClassification(layer.id, classIndex, i, groupName)} legend={legend} />
+ ) : null
+ }
<Palette
setCustomPalette={setCustomPalette}
groupName={groupName}
diff --git a/web/js/components/sidebar/paletteLegend.js b/web/js/components/sidebar/paletteLegend.js
index 635171ea5..cbd053485 100644
--- a/web/js/components/sidebar/paletteLegend.js
+++ b/web/js/components/sidebar/paletteLegend.js
@@ -258,8 +258,8 @@ class PaletteLegend extends React.Component {
{isMoreThanOneColorBar ? (
<div className="wv-palettes-title">{legend.title}</div>
) : (
- ''
- )}
+ ''
+ )}
<div className="colorbar-case">
<canvas
className="wv-palettes-colorbar"
@@ -348,17 +348,12 @@ class PaletteLegend extends React.Component {
const tooltipText = singleKey
? layer.track ? trackLabel : legendTooltip
: keyLabel;
- const checkerBoardPattern = {
- backgroundImage: 'linear-gradient(45deg, #808080 25%, transparent 25%), linear-gradient(-45deg, #808080 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #808080 75%), linear-gradient(-45deg, transparent 75%, #808080 75%)',
- backgroundSize: '20px 20px',
- backgroundPosition: '0 0, 0 10px, 10px -10px, -10px 0px'
- }
- console.log(color === '00000000')
+
return (
<React.Fragment key={keyId}>
<span
id={keyId}
- className={color === '00000000' ? palletteClass + ' checker-board-pattern': palletteClass}
+ className={color === '00000000' ? palletteClass + ' checker-board-pattern' : palletteClass}
style={color === '00000000' ? {} : { backgroundColor: util.hexToRGBA(color) }}
onMouseMove={this.onMove.bind(this, color)}
onMouseEnter={this.onMouseEnter.bind(this)}
diff --git a/web/js/components/util/switch.js b/web/js/components/util/switch.js
index 9bc7e5e21..f7ddce539 100644
--- a/web/js/components/util/switch.js
+++ b/web/js/components/util/switch.js
@@ -13,8 +13,8 @@ const Switch = (props) => {
type="checkbox"
checked={isActive}
onChange={() => {
- toggle()
- toggleActive(!isActive)
+ toggle();
+ toggleActive(!isActive);
}}
/>
<label
@@ -22,7 +22,7 @@ const Switch = (props) => {
htmlFor={id}
style={style}
>
- <span className={`react-switch-button`} />
+ <span className={'react-switch-button'} />
</label>
</div>
@@ -31,4 +31,4 @@ const Switch = (props) => {
);
};
-export default Switch;
\ No newline at end of file
+export default Switch;
diff --git a/web/js/modules/palettes/actions.js b/web/js/modules/palettes/actions.js
index 1d9f9958c..e1254b6f9 100644
--- a/web/js/modules/palettes/actions.js
+++ b/web/js/modules/palettes/actions.js
@@ -130,7 +130,7 @@ export function clearCustoms() {
const groupName = compare.activeString;
const activePalettes = palettes[groupName];
const props = { squash: undefined, min: undefined, max: undefined };
- lodashForOwn(activePalettes, function (value, key) {
+ lodashForOwn(activePalettes, function(value, key) {
activePalettes[key].maps.forEach((colormap, index) => {
if (colormap.custom) {
dispatch(clearCustomPalette(key, index, groupName));
@@ -173,4 +173,4 @@ export function setToggledClassification(layerId, classIndex, index, groupName)
props: { disabled: classIndex }
});
};
-};
\ No newline at end of file
+};
diff --git a/web/js/modules/palettes/selectors.js b/web/js/modules/palettes/selectors.js
index c8d92bbd2..4efd08ae5 100644
--- a/web/js/modules/palettes/selectors.js
+++ b/web/js/modules/palettes/selectors.js
@@ -109,10 +109,10 @@ export function getCustomPalette(paletteId, customsPaletteConfig) {
}
return palette;
}
-var useLookup = function (layerId, palettesObj, state) {
+var useLookup = function(layerId, palettesObj, state) {
var use = false;
var active = palettesObj[layerId].maps;
- lodashEach(active, function (palette, index) {
+ lodashEach(active, function(palette, index) {
if (palette.custom) {
use = true;
return false;
@@ -140,7 +140,7 @@ export function getLookup(layerId, groupstr, state) {
groupstr = groupstr || state.compare.activeString;
return state.palettes[groupstr][layerId].lookup;
}
-var updateLookup = function (layerId, palettesObj, state) {
+var updateLookup = function(layerId, palettesObj, state) {
let newPalettes = palettesObj;
if (!useLookup(layerId, newPalettes, state)) {
delete newPalettes[layerId];
@@ -149,7 +149,7 @@ var updateLookup = function (layerId, palettesObj, state) {
var lookup = {};
var active = newPalettes[layerId].maps;
- lodashEach(active, function (palette, index) {
+ lodashEach(active, function(palette, index) {
var oldLegend = palette.legend;
var entries = palette.entries;
const refs = oldLegend.refs;
@@ -176,12 +176,9 @@ var updateLookup = function (layerId, palettesObj, state) {
var targetCount = target.length;
var appliedLegends = [];
var disabled = palette.disabled || [];
- lodashEach(source, function (color, index) {
+ lodashEach(source, function(color, index) {
var targetColor;
if (index < min || index > max || disabled.includes(index)) {
- if (disabled.includes(index)) {
- console.log(disabled)
- }
targetColor = '00000000';
} else {
var sourcePercent, targetIndex;
@@ -237,7 +234,7 @@ export function findIndex(layerId, type, value, index, groupStr, state) {
index = index || 0;
var values = getPalette(layerId, index, groupStr, state).entries.values;
var result;
- lodashEach(values, function (check, index) {
+ lodashEach(values, function(check, index) {
var min = getMinValue(check);
var max = getMaxValue(check);
if (type === 'min' && value === min) {
@@ -299,8 +296,8 @@ export function setDisabledSelector(
state
) {
let newPalettes = prepare(layerId, palettes, state);
- let legend = getPalette(layerId, index, undefined, state);
- let oldDisabled = legend.disabled || [];
+ const legend = getPalette(layerId, index, undefined, state);
+ const oldDisabled = legend.disabled || [];
const indexOf = oldDisabled.indexOf(classIndex);
indexOf !== -1 ? oldDisabled.splice(indexOf, 1) : oldDisabled.push(classIndex);
newPalettes = update(newPalettes, {
@@ -367,12 +364,12 @@ export function clearCustomSelector(layerId, index, palettes, state) {
}); // remove custom key
return updateLookup(layerId, newPalettes, state);
}
-var prepare = function (layerId, palettesObj, state) {
+var prepare = function(layerId, palettesObj, state) {
var newPalettes = lodashCloneDeep(palettesObj);
if (!newPalettes[layerId]) newPalettes[layerId] = {};
var active = newPalettes[layerId];
active.maps = active.maps || [];
- lodashEach(getRenderedPalette(layerId, undefined, state).maps, function (
+ lodashEach(getRenderedPalette(layerId, undefined, state).maps, function(
palette,
index
) {