Update Control.FullScreen to 1.4.5.

This commit is contained in:
David Molineus
2018-08-23 15:40:48 +02:00
parent 3b187d0d95
commit 2f372e2d0e
8 changed files with 18 additions and 17 deletions

View File

@@ -46,12 +46,12 @@ L.Control.FullScreen = L.Control.extend({
L.DomEvent
.addListener(container, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.addListener(container, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.addListener(container, fullScreenApi.fullScreenEventName, this._handleEscKey, context);
.addListener(container, fullScreenApi.fullScreenEventName, this._handleFullscreenChange, context);
L.DomEvent
.addListener(document, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.addListener(document, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.addListener(document, fullScreenApi.fullScreenEventName, this._handleEscKey, context);
.addListener(document, fullScreenApi.fullScreenEventName, this._handleFullscreenChange, context);
return this.link;
},
@@ -61,11 +61,10 @@ L.Control.FullScreen = L.Control.extend({
map._exitFired = false;
if (map._isFullscreen) {
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
fullScreenApi.cancelFullScreen(this.options.fullscreenElement ? this.options.fullscreenElement : map._container);
fullScreenApi.cancelFullScreen();
} else {
L.DomUtil.removeClass(map._container, 'leaflet-pseudo-fullscreen');
L.DomUtil.removeClass(this.options.fullscreenElement ? this.options.fullscreenElement : map._container, 'leaflet-pseudo-fullscreen');
}
map.invalidateSize();
map.fire('exitFullscreen');
map._exitFired = true;
map._isFullscreen = false;
@@ -74,9 +73,8 @@ L.Control.FullScreen = L.Control.extend({
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
fullScreenApi.requestFullScreen(this.options.fullscreenElement ? this.options.fullscreenElement : map._container);
} else {
L.DomUtil.addClass(map._container, 'leaflet-pseudo-fullscreen');
L.DomUtil.addClass(this.options.fullscreenElement ? this.options.fullscreenElement : map._container, 'leaflet-pseudo-fullscreen');
}
map.invalidateSize();
map.fire('enterFullscreen');
map._isFullscreen = true;
}
@@ -86,9 +84,10 @@ L.Control.FullScreen = L.Control.extend({
this.link.title = this._map._isFullscreen ? this.options.title : this.options.titleCancel;
},
_handleEscKey: function () {
_handleFullscreenChange: function () {
var map = this._map;
if (!fullScreenApi.isFullScreen(map) && !map._exitFired) {
map.invalidateSize();
if (!fullScreenApi.isFullScreen() && !map._exitFired) {
map.fire('exitFullscreen');
map._exitFired = true;
map._isFullscreen = false;