Merge pull request #5113 from AvatharDG/patch-1

Memory leak in ol.control.FullScreen
This commit is contained in:
Andreas Hocevar
2016-03-24 11:09:04 +01:00

View File

@@ -68,10 +68,6 @@ ol.control.FullScreen = function(opt_options) {
ol.events.listen(button, ol.events.EventType.CLICK,
this.handleClick_, this);
ol.events.listen(goog.global.document,
goog.dom.fullscreen.EventType.CHANGE,
this.handleFullScreenChange_, this);
var cssClasses = this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE +
' ' + ol.css.CLASS_CONTROL + ' ' +
(!goog.dom.fullscreen.isSupported() ? ol.css.CLASS_UNSUPPORTED : '');
@@ -153,3 +149,18 @@ ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
map.updateSize();
}
};
/**
* @inheritDoc
* @api stable
*/
ol.control.FullScreen.prototype.setMap = function(map) {
goog.base(this, 'setMap', map);
if (map) {
this.listenerKeys.push(
ol.events.listen(goog.global.document, goog.dom.fullscreen.EventType.CHANGE,
this.handleFullScreenChange_, this)
);
}
};