ol.control.Attribution no longer relies on map.getEvents

This commit is contained in:
Éric Lemoine
2012-07-09 09:31:33 +02:00
parent e0b53360d2
commit bc72e2e444

View File

@@ -55,7 +55,8 @@ ol.control.Attribution.prototype.setMap = function(map) {
ol.control.Attribution.prototype.activate = function() { ol.control.Attribution.prototype.activate = function() {
var active = goog.base(this, 'activate'); var active = goog.base(this, 'activate');
if (active) { if (active) {
this.map_.getEvents().register('layeradd', this.update, this); goog.events.listen(this.map_, 'layeradd', this.update,
undefined, this);
this.update(); this.update();
} }
return active; return active;
@@ -65,7 +66,8 @@ ol.control.Attribution.prototype.activate = function() {
ol.control.Attribution.prototype.deactivate = function() { ol.control.Attribution.prototype.deactivate = function() {
var inactive = goog.base(this, 'deactivate'); var inactive = goog.base(this, 'deactivate');
if (inactive) { if (inactive) {
this.map_.getEvents().unregister('layeradd', this.update, this); goog.events.unlisten(this.map_, 'layeradd', this.update,
undefined, this);
} }
return inactive; return inactive;
}; };
@@ -89,4 +91,4 @@ ol.control.Attribution.prototype.destroy = function() {
goog.base(this, 'destroy'); goog.base(this, 'destroy');
}; };
ol.control.addControl('attribution', ol.control.Attribution); ol.control.addControl('attribution', ol.control.Attribution);