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:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user