Making backbuffer order configurable

In OpenLayers 2.12, the backbuffer for each layer was placed right below
the layer itself. With animated zooming, that was changed so backbuffers
are all placed below the base layer. As it turned out, this is only good
for certain kinds of layers (e.g. street labels), so the default now is
to place the backbuffer right below its layer again. But the
transitionEffect option can now have a new value, 'map-resize', which will
cause the backbuffer to be placed below the base layer.
This commit is contained in:
ahocevar
2013-03-27 17:46:36 +01:00
parent fe172ccf6e
commit 434178ef49
2 changed files with 24 additions and 7 deletions

View File

@@ -98,9 +98,14 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* Two posible values:
*
* "resize" - Existing tiles are resized on zoom to provide a visual
* effect of the zoom having taken place immediately. As the
* new tiles become available, they are drawn over top of the
* resized tiles (this is the default setting).
* effect of the zoom having taken place immediately. As the
* new tiles become available, they are drawn over top of the
* resized tiles (this is the default setting).
* "map-resize" - Existing tiles are resized on zoom and placed below the
* base layer. New tiles for the base layer will cover existing tiles.
* This setting is recommended when having an overlay duplicated during
* the transition is undesirable (e.g. street labels or big transparent
* fills).
* null - No transition effect.
*
* Using "resize" on non-opaque layers can cause undesired visual
@@ -705,8 +710,12 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
backBuffer.id = this.div.id + '_bb';
backBuffer.className = 'olBackBuffer';
backBuffer.style.position = 'absolute';
backBuffer.style.zIndex = this.map.Z_INDEX_BASE.BaseLayer -
(this.map.getNumLayers() - this.map.getLayerIndex(this));
var map = this.map;
backBuffer.style.zIndex = this.transitionEffect === 'resize' ?
this.getZIndex() - 1 :
// 'map-resize':
map.Z_INDEX_BASE.BaseLayer -
(map.getNumLayers() - map.getLayerIndex(this));
for(var i=0, lenI=this.grid.length; i<lenI; i++) {
for(var j=0, lenJ=this.grid[i].length; j<lenJ; j++) {
var tile = this.grid[i][j],