From 86cd9c7bf73e048a9f010afc08e0ab0457154a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 31 Mar 2012 21:22:36 +0200 Subject: [PATCH] add class to Layer.Grid layer div --- lib/OpenLayers/Layer/Grid.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 3dc3f057f1..7d9ffd0d39 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -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 layers, and + * "olLayerGridTile" for non- 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 - {} 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.