Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Apply custom styles to A and B state by checking activeGroupStr

ZachTRicefdc705ae2e9f
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index b9569e408..9505ce514 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -313,6 +313,7 @@ export function mapLayerBuilder(models, config, cache, mapUi, store) {
var date, urlParameters, extent, source, matrixSet, matrixIds, start;
const selectedProj = proj.selected;
const activeDateStr = compare.isCompareA ? 'selected' : 'selectedB';
+ const activeGroupStr = options.group ? options.group : compare.activeString;
source = config.sources[def.source];
extent = selectedProj.maxExtent;
@@ -387,16 +388,14 @@ export function mapLayerBuilder(models, config, cache, mapUi, store) {
if (config.vectorStyles && def.vectorStyle && def.vectorStyle.id) {
var vectorStyles = config.vectorStyles;
var vectorStyleId;
- console.log(state);
- // TODO: Change active to groupName
+
// TODO change `0` to actually loop through the active layers
// and find the one equal to layerName
- if (state.layers.active[0].id === layerName && state.layers.active[0].custom) {
- vectorStyleId = state.layers.active[0].custom;
+ if (state.layers[activeGroupStr] && state.layers[activeGroupStr][0].id === layerName && state.layers[activeGroupStr][0].custom) {
+ vectorStyleId = state.layers[activeGroupStr][0].custom;
} else {
vectorStyleId = def.vectorStyle.id;
}
- // var vectorStyleId = def.vectorStyle.id;
setStyleFunction(def, vectorStyleId, vectorStyles, layer, state);
}
diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.js
index 5a70ed5bd..fcc9bc8be 100644
--- a/web/js/modules/vector-styles/selectors.js
+++ b/web/js/modules/vector-styles/selectors.js
@@ -258,9 +258,11 @@ export function setStyleFunction(def, vectorStyleId, vectorStyles, layer, state)
}
});
}
- console.log(layer, glStyle, vectorStyleId);
+
+ // Apply mapbox-gl styles
styleFunction = stylefunction(layer, glStyle, vectorStyleId);
+ // Filter Orbit Tracks
if (glStyle.name === 'Orbit Tracks') {
// Filter time by 5 mins
layer.setStyle(function(feature, resolution) {