add class to Layer.Grid layer div

This commit is contained in:
Éric Lemoine
2012-03-31 21:22:36 +02:00
parent 35333681c1
commit 86cd9c7bf7

View File

@@ -188,6 +188,14 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
*/
removeBackBufferDelay: 2500,
/**
* Property: className
* {String} Name of the class added to the layer div. Default is
* "olLayerGridSingleTile" for <singleTile> layers, and
* "olLayerGridTile" for non-<singleTile> layers.
*/
className: null,
/**
* Register a listener for a particular event with the following syntax:
* (code)
@@ -233,6 +241,11 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this.grid = [];
this.tileQueue = [];
if (this.className === null) {
this.className = this.singleTile ? 'olLayerGridSingleTile' :
'olLayerGridTile';
}
if (!OpenLayers.Animation.isNative) {
this.deferMoveGriddedTiles = OpenLayers.Function.bind(function() {
this.moveGriddedTiles(true);
@@ -241,6 +254,17 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
}
},
/**
* Method: setMap
*
* Parameters:
* map - {<OpenLayers.Map>} The map.
*/
setMap: function(map) {
OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this, map);
OpenLayers.Element.addClass(this.div, this.className);
},
/**
* Method: removeMap
* Called when the layer is removed from the map.