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
+7
View File
@@ -66,6 +66,7 @@ describe('ol.layer.Layer', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
minResolution: 0
});
@@ -86,6 +87,7 @@ describe('ol.layer.Layer', function() {
opacity: 0.5,
saturation: 5,
visible: false,
zIndex: 10,
maxResolution: 500,
minResolution: 0.25,
foo: 42
@@ -111,6 +113,7 @@ describe('ol.layer.Layer', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 10,
maxResolution: 500,
minResolution: 0.25
});
@@ -194,6 +197,7 @@ describe('ol.layer.Layer', function() {
layer.setVisible(false);
layer.setMaxResolution(500);
layer.setMinResolution(0.25);
layer.setZIndex(10);
expect(layer.getLayerState()).to.eql({
layer: layer,
brightness: -0.7,
@@ -205,6 +209,7 @@ describe('ol.layer.Layer', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 10,
maxResolution: 500,
minResolution: 0.25
});
@@ -228,6 +233,7 @@ describe('ol.layer.Layer', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
minResolution: 0
});
@@ -249,6 +255,7 @@ describe('ol.layer.Layer', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
minResolution: 0
});