Add Z-index to layers

This commit allows setting a z-index property on the layers and uses
it in the canvas, WEBGL and DOM map renderers for ordering the layers
before rendering.

Default z-index is 0 for managed layers and 1000 for unmanaged ones.
It allows always on bottom, always on top and more complex layer layouts.
This commit is contained in:
Guillaume Beraudo
2015-09-01 17:47:47 +02:00
parent 34f65a8908
commit 3811228ac7
11 changed files with 216 additions and 0 deletions
+10
View File
@@ -375,3 +375,13 @@ ol.renderer.Map.prototype.scheduleRemoveUnusedLayerRenderers =
}
}
};
/**
* @param {ol.layer.LayerState} state1
* @param {ol.layer.LayerState} state2
* @return {number}
*/
ol.renderer.Map.sortByZIndex = function(state1, state2) {
return state1.zIndex - state2.zIndex;
};