Merge pull request #5548 from GaborFarkas/fullscreen_event_enum

Fix CHANGETYPE in ol.control.FullScreen
This commit is contained in:
Andreas Hocevar
2016-07-03 11:25:39 +02:00
committed by GitHub
+15 -9
View File
@@ -162,8 +162,8 @@ ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
ol.control.FullScreen.prototype.setMap = function(map) { ol.control.FullScreen.prototype.setMap = function(map) {
ol.control.Control.prototype.setMap.call(this, map); ol.control.Control.prototype.setMap.call(this, map);
if (map) { if (map) {
this.listenerKeys.push( this.listenerKeys.push(ol.events.listen(ol.global.document,
ol.events.listen(ol.global.document, ol.control.FullScreen.CHANGETYPE, ol.control.FullScreen.getChangeType_(),
this.handleFullScreenChange_, this) this.handleFullScreenChange_, this)
); );
} }
@@ -238,18 +238,24 @@ ol.control.FullScreen.exitFullScreen = function() {
}; };
/** /**
* @type {string} * @return {string} Change type.
* @private
*/ */
ol.control.FullScreen.CHANGETYPE = (function() { ol.control.FullScreen.getChangeType_ = (function() {
var changeType;
return function() {
if (!changeType) {
var body = document.body; var body = document.body;
if (body.webkitRequestFullscreen) { if (body.webkitRequestFullscreen) {
return 'webkitfullscreenchange'; changeType = 'webkitfullscreenchange';
} else if (body.mozRequestFullScreen) { } else if (body.mozRequestFullScreen) {
return 'mozfullscreenchange'; changeType = 'mozfullscreenchange';
} else if (body.msRequestFullscreen) { } else if (body.msRequestFullscreen) {
return 'MSFullscreenChange'; changeType = 'MSFullscreenChange';
} else if (body.requestFullscreen) { } else if (body.requestFullscreen) {
return 'fullscreenchange'; changeType = 'fullscreenchange';
} }
return undefined; }
return changeType;
};
})(); })();