give Control classes same setMap() functionality as Layer

git-svn-id: http://svn.openlayers.org/trunk/openlayers@936 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-12 00:16:14 +00:00
parent a52b1fc8f1
commit ec33ac4a84
2 changed files with 11 additions and 1 deletions

View File

@@ -24,6 +24,16 @@ OpenLayers.Control.prototype = {
Object.extend(this, options);
},
/** Set the map property for the control. This is done through an accessor
* so that subclasses can override this and take special action once
* they have their map variable set.
*
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
this.map = map;
},
/**
* @param {OpenLayers.Pixel} px
*

View File

@@ -318,7 +318,7 @@ OpenLayers.Map.prototype = {
* @param {OpenLayers.Pixel} px
*/
addControl: function (control, px) {
control.map = this;
control.setMap(this);
this.controls.push(control);
var div = control.draw(px);
if (div) {