Move postrender event listening into base class

This commit is contained in:
Tom Payne
2013-04-05 20:33:50 +02:00
parent da1e5aadd3
commit 06bcab8374
6 changed files with 31 additions and 118 deletions
-25
View File
@@ -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