Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fix vector style not being applied when changing date

ZachTRice208cfe0cd630
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index f13e55228..744838e10 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -38,6 +38,7 @@ import * as layerConstants from '../modules/layers/constants';
import * as compareConstants from '../modules/compare/constants';
import * as paletteConstants from '../modules/palettes/constants';
import * as vectorStyleConstants from '../modules/vector-styles/constants';
+import { setStyleFunction } from '../modules/vector-styles/selectors';
import {
getLayers,
isRenderable as isRenderableLayer
@@ -592,6 +593,8 @@ export function mapui(models, config, store, ui) {
}
}
lodashEach(activeLayers, function(def) {
+ const layerName = def.layer || def.id;
+
if (!['subdaily', 'daily', 'monthly', 'yearly'].includes(def.period)) {
return;
}
@@ -612,6 +615,21 @@ export function mapui(models, config, store, ui) {
let index = findLayerIndex(def);
self.selected.getLayers().setAt(index, createLayer(def));
}
+ if (config.vectorStyles && def.vectorStyle && def.vectorStyle.id) {
+ var vectorStyles = config.vectorStyles;
+ var vectorStyleId;
+
+ vectorStyleId = def.vectorStyle.id;
+ if (state.layers[activeLayerStr]) {
+ let layers = state.layers[activeLayerStr];
+ layers.forEach(layer => {
+ if (layer.id === layerName && layer.custom) {
+ vectorStyleId = layer.custom;
+ }
+ });
+ }
+ setStyleFunction(def, vectorStyleId, vectorStyles, null, state);
+ }
});
updateLayerVisibilities();
};