Skip to content

Commit

Permalink
CLMS-2802 (bug): filtered hotspot layers swap index orders in map whe…
Browse files Browse the repository at this point in the history
…n dataset orders are changed in the active layers tab
  • Loading branch information
ujbolivar committed May 10, 2024
1 parent e76f6e5 commit 1b37250
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion src/components/MapViewer/MenuWidget.jsx
Expand Up @@ -2873,10 +2873,31 @@ class MenuWidget extends React.Component {
layersReorder() {
let activeLayers = document.querySelectorAll('.active-layer');
let counter = activeLayers.length - 1;
let filterLayer;
activeLayers.forEach((item, index) => {
if (
this.props.hotspotData &&
this.props.hotspotData.filteredLayers &&
Object.keys(this.props.hotspotData.filteredLayers).length > 0
) {
Object.keys(this.props.hotspotData.activeLayers).forEach((key) => {
if (item.id.includes(key)) {
if (key.includes('all_lcc')) {
filterLayer = this.layers['lcc_filter'];
} else if (key.includes('all_present')) {
filterLayer = this.layers['lc_filter'];
}
}
this.map.reorder(filterLayer, index);
});
}
let order = counter - index;
item.setAttribute('layer-order', order);
this.layerReorder(this.layers[item.getAttribute('layer-id')], order);
if (filterLayer === undefined) {
this.layerReorder(this.layers[item.getAttribute('layer-id')], order);
} else {
this.layerReorder(filterLayer, order);
}
});
}

Expand All @@ -2901,7 +2922,25 @@ class MenuWidget extends React.Component {
* @param {*} index
*/
layerReorder(layer, index) {
let filterLayer;
//if (this.props.hotspotData &&
// this.props.hotspotData.filteredLayers &&
// Object.keys(this.props.hotspotData.filteredLayers).length > 0
//) {
// //debugger;
// Object.keys(this.props.hotspotData.activeLayers).forEach((key) => {
// if (layer.id === key) {
// if (key.includes('all_lcc')) {
// filterLayer = this.layers['lcc_filter'];
// } else if (key.includes('all_present')) {
// filterLayer = this.layers['lc_filter'];
// }
// }
// this.map.reorder(filterLayer, index);
// });
//} else {
this.map.reorder(layer, index);
//}
}

/**
Expand Down

0 comments on commit 1b37250

Please sign in to comment.