Move postrender event listening into base class
This commit is contained in:
@@ -2,12 +2,9 @@ goog.provide('ol.control.Logo');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.object');
|
||||
goog.require('goog.style');
|
||||
goog.require('ol.FrameState');
|
||||
goog.require('ol.MapEvent');
|
||||
goog.require('ol.MapEventType');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
|
||||
@@ -50,12 +47,6 @@ ol.control.Logo = function(opt_options) {
|
||||
*/
|
||||
this.logoElements_ = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?number}
|
||||
*/
|
||||
this.postrenderListenKey_ = null;
|
||||
|
||||
};
|
||||
goog.inherits(ol.control.Logo, ol.control.Control);
|
||||
|
||||
@@ -68,22 +59,6 @@ ol.control.Logo.prototype.handleMapPostrender = function(mapEvent) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.Logo.prototype.setMap = function(map) {
|
||||
if (!goog.isNull(this.postrenderListenKey_)) {
|
||||
goog.events.unlistenByKey(this.postrenderListenKey_);
|
||||
this.postrenderListenKey_ = null;
|
||||
}
|
||||
goog.base(this, 'setMap', map);
|
||||
if (!goog.isNull(map)) {
|
||||
this.postrenderListenKey_ = goog.events.listen(
|
||||
map, ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {?ol.FrameState} frameState Frame state.
|
||||
* @private
|
||||
|
||||
Reference in New Issue
Block a user