Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WV-2887 Preload Tour Story Imagery (no custom palettes) #4935

Merged
merged 9 commits into from
Jan 29, 2024
Prev Previous commit
Next Next commit
Refactored
  • Loading branch information
christof-wittreich committed Jan 17, 2024
commit f504c406465bdde7189f4bb701efc7ed14494e6e
24 changes: 14 additions & 10 deletions web/js/containers/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ const getTransitionAttr = function(transition) {
return '';
};

const prepareLayersList = function(layersString, config) {
let layers;
layers = layersParse12(layersString, config);
layers = uniqBy(layers, 'id');
layers = layers.filter((layer) => !layer.custom && !layer.disabled);
return layers;
};

class Tour extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -545,16 +553,12 @@ const mapDispatchToProps = (dispatch) => ({
const promisesParams = [];

if (parameters.l) {
layersA = layersParse12(parameters.l, config);
layersA = uniqBy(layersA, 'id');
layersA = layersA.filter((layer) => !layer.custom && !layer.disabled);
promisesParams.push({ layersA, dateString: parameters.t });
if (parameters.l1) {
layersB = layersParse12(parameters.l1, config);
layersB = uniqBy(layersB, 'id');
layersB = layersB.filter((layer) => !layer.custom && !layer.disabled);
promisesParams.push({ layers: layersB, dateString: parameters.t1, activeString: 'activeB' });
}
layersA = prepareLayersList(parameters.l, config);
promisesParams.push({ layers: layersA, dateString: parameters.t });
}
if (parameters.l1) {
layersB = prepareLayersList(parameters.l1, config);
promisesParams.push({ layers: layersB, dateString: parameters.t1, activeString: 'activeB' });
}
preloadPalettes([...layersA, ...layersB], {}, false).then(async (obj) => {
await dispatch({
Expand Down
Loading