ol.control.Attribution no longer require ol.event
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
goog.provide('ol.control.Attribution');
|
goog.provide('ol.control.Attribution');
|
||||||
|
|
||||||
goog.require('ol.event');
|
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
|
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
@@ -43,7 +42,7 @@ ol.control.Attribution.prototype.setMap = function(map) {
|
|||||||
var staticOverlay = map.getStaticOverlay();
|
var staticOverlay = map.getStaticOverlay();
|
||||||
if (goog.isNull(this.container_)) {
|
if (goog.isNull(this.container_)) {
|
||||||
this.container_ = goog.dom.createDom('div', this.CLS);
|
this.container_ = goog.dom.createDom('div', this.CLS);
|
||||||
goog.events.listen(this.container_, 'click', ol.event.stopPropagation);
|
goog.events.listen(this.container_, 'click', this.stopEventPropagation);
|
||||||
}
|
}
|
||||||
if (!goog.isNull(staticOverlay)) {
|
if (!goog.isNull(staticOverlay)) {
|
||||||
goog.dom.append(staticOverlay, this.container_);
|
goog.dom.append(staticOverlay, this.container_);
|
||||||
@@ -55,8 +54,7 @@ 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) {
|
||||||
goog.events.listen(this.map_, 'layeradd', this.update,
|
goog.events.listen(this.map_, 'layeradd', this.update, undefined, this);
|
||||||
undefined, this);
|
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
return active;
|
return active;
|
||||||
@@ -66,8 +64,7 @@ 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) {
|
||||||
goog.events.unlisten(this.map_, 'layeradd', this.update,
|
goog.events.unlisten(this.map_, 'layeradd', this.update, undefined, this);
|
||||||
undefined, this);
|
|
||||||
}
|
}
|
||||||
return inactive;
|
return inactive;
|
||||||
};
|
};
|
||||||
@@ -86,9 +83,16 @@ ol.control.Attribution.prototype.update = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ol.control.Attribution.prototype.destroy = function() {
|
ol.control.Attribution.prototype.destroy = function() {
|
||||||
goog.events.unlisten(this.container_, 'click', ol.event.stopPropagation);
|
goog.events.unlisten(this.container_, 'click', this.stopEventPropagation);
|
||||||
goog.dom.removeNode(this.container_);
|
goog.dom.removeNode(this.container_);
|
||||||
goog.base(this, 'destroy');
|
goog.base(this, 'destroy');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {goog.events.BrowserEvent} e
|
||||||
|
*/
|
||||||
|
ol.control.Attribution.prototype.stopEventPropagation = function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
ol.control.addControl('attribution', ol.control.Attribution);
|
ol.control.addControl('attribution', ol.control.Attribution);
|
||||||
|
|||||||
Reference in New Issue
Block a user