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

Handle QGIS Control rendering order #3849

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 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,9 @@ export default class BaseLayersMap extends olMap {
name: node.name
});

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

this._overlayLayersAndGroups.push(layer);
this._statesOlLayersandGroupsMap.set(node.name, [node, layer]);
return layer;
Expand Down
2 changes: 1 addition & 1 deletion assets/src/modules/state/Layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ export class LayerGroupState extends LayerItemState {
**/
get layerOrder() {
if (this._layerOrder == -1) {
for (const layer of this.itemState.findLayers()) {
for (const layer of this.findLayers()) {
if (this._layerOrder == -1 || layer.layerOrder < this._layerOrder) {
this._layerOrder = layer.layerOrder;
}
Expand Down
Loading
Loading