ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
680 stars 227 forks source link

Reordering layers #368

Closed sh-aix closed 3 years ago

sh-aix commented 3 years ago

Hey there,

I am trying to reorder different layers in vuelayers. Like in the demo, I create the layer components from a config array. However, reordering the config array does not reorder the appearance in the map. It is not passed through to the layer array of the map object.

Is there a way to force the reordering of the layer components?

Regards, SH

ghettovoice commented 3 years ago

Hello @sh-aix , yes, vuelayers is not guarantee that order of vl-layer-* components inside template will match order of layers inside ol/Map due too asynchronous initialization of ol objects.

But you still force layer ordering on Z axis with z-index property. It is very similar to CSS z-index, i.e. the higher the value, the higher the layer.

sh-aix commented 3 years ago

Ok thanks. I got it working. I reassign the z-index if the user reorders the layers in the layer tree.