Minor attribution control clean-ups
This commit is contained in:
@@ -8,7 +8,6 @@ goog.require('goog.dom.TagName');
|
|||||||
goog.require('goog.events');
|
goog.require('goog.events');
|
||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
goog.require('ol');
|
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.FrameState');
|
goog.require('ol.FrameState');
|
||||||
goog.require('ol.MapEvent');
|
goog.require('ol.MapEvent');
|
||||||
@@ -28,6 +27,10 @@ ol.control.Attribution = function(opt_options) {
|
|||||||
|
|
||||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Element}
|
||||||
|
*/
|
||||||
this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL);
|
this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL);
|
||||||
|
|
||||||
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
|
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
|
||||||
@@ -60,9 +63,9 @@ ol.control.Attribution = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Array.<?number>}
|
* @type {?number}
|
||||||
*/
|
*/
|
||||||
this.listenerKeys_ = null;
|
this.postrenderListenKey_ = null;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.control.Attribution, ol.control.Control);
|
goog.inherits(ol.control.Attribution, ol.control.Control);
|
||||||
@@ -115,16 +118,14 @@ ol.control.Attribution.prototype.handleMapPostrender = function(mapEvent) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.control.Attribution.prototype.setMap = function(map) {
|
ol.control.Attribution.prototype.setMap = function(map) {
|
||||||
if (!goog.isNull(this.listenerKeys_)) {
|
if (!goog.isNull(this.postrenderListenKey_)) {
|
||||||
goog.array.forEach(this.listenerKeys_, goog.events.unlistenByKey);
|
goog.events.unlistenByKey(this.postrenderListenKey_);
|
||||||
this.listenerKeys_ = null;
|
this.postrenderListenKey_ = null;
|
||||||
}
|
}
|
||||||
goog.base(this, 'setMap', map);
|
goog.base(this, 'setMap', map);
|
||||||
if (!goog.isNull(map)) {
|
if (!goog.isNull(map)) {
|
||||||
this.listenerKeys_ = [
|
this.postrenderListenKey_ = goog.events.listen(
|
||||||
goog.events.listen(map, ol.MapEventType.POSTRENDER,
|
map, ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this);
|
||||||
this.handleMapPostrender, false, this)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user