From e53e339c092596497a5e5afc7f9ba2495c777969 Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 6 Jun 2006 15:50:15 +0000 Subject: [PATCH] make setting the map a function call. this way we can intercept and tag on event handlers. git-svn-id: http://svn.openlayers.org/trunk/openlayers@528 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer.js | 7 +++++++ lib/OpenLayers/Map.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index a95008c76e..8b0ddf9e54 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -43,6 +43,13 @@ OpenLayers.Layer.prototype = { return; }, + /** + * @param {OpenLayers.Map} map + */ + setMap: function(map) { + this.map = map; + }, + /** * @return {bool} */ diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 0009f45edb..f187c755e6 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -129,7 +129,7 @@ OpenLayers.Map.prototype = { * @param {OpenLayers.Layer} layer */ addLayer: function (layer, zIndex) { - layer.map = this; + layer.setMap(this); layer.div.style.overflow = ""; if (zIndex) { layer.div.style.zIndex = zIndex;