Skip to content

Commit

Permalink
Handle QGIS Control rendering order
Browse files Browse the repository at this point in the history
  • Loading branch information
nboisteault committed Aug 21, 2023
1 parent 7592e90 commit 5184591
Show file tree
Hide file tree
Showing 3 changed files with 2,253 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/src/modules/BaseLayersMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ export default class BaseLayersMap extends olMap {
// Array of layers and groups in overlayLayerGroup
this._overlayLayersAndGroups = [];

const layersCount = mainLizmap.state.rootMapGroup.findMapLayers().length;

// Returns a layer or a layerGroup depending of the node type
const createNode = (node) => {
if(node.type === 'group'){
Expand Down Expand Up @@ -274,6 +276,11 @@ export default class BaseLayersMap extends olMap {
name: node.name
});

// OL layers zIndex is the reverse of layer's order given by cfg
if (!node.itemState.groupAsLayer){
layer.setZIndex(layersCount - 1 - node.layerOrder);
}

this._overlayLayersAndGroups.push(layer);
this._statesOlLayersandGroupsMap.set(node.name, [node, layer]);
return layer;
Expand Down
Loading

0 comments on commit 5184591

Please sign in to comment.