From 2f372e2d0ebc1ec3ffc07c04e40201edac45a1d8 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Thu, 23 Aug 2018 15:40:48 +0200 Subject: [PATCH] Update Control.FullScreen to 1.4.5. --- README.md | 2 +- assets/leaflet-fullscreen/Control.FullScreen.js | 17 ++++++++--------- .../Control.FullScreen.min.js | 2 +- assets/leaflet-fullscreen/README.md | 2 ++ assets/leaflet-fullscreen/bower.json | 2 +- assets/leaflet-fullscreen/index.html | 4 ++-- assets/leaflet-fullscreen/package.json | 4 ++-- module/config/config.php | 2 +- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 0a001fa..af5d6bc 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This package contains following packages: - [Leaflet.markercluster 1.4.0](https://github.com/Leaflet/Leaflet.markercluster) - [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore) - [Leaflet.loading 0.1.24](https://github.com/ebrelsford/Leaflet.loading) - - [Leaflet.Control.FullScreen 1.4.3](https://github.com/brunob/leaflet.fullscreen) + - [Leaflet.Control.FullScreen 1.4.5](https://github.com/brunob/leaflet.fullscreen) - [Leaflet Control Geocoder 1.5.8](https://github.com/perliedman/leaflet-control-geocoder) - [Leaflet.ExtraMarkers 1.0.6](https://github.com/coryasilva/Leaflet.ExtraMarkers) - [leaflet.pm 0.23.1](https://github.com/codeofsumit/leaflet.pm) diff --git a/assets/leaflet-fullscreen/Control.FullScreen.js b/assets/leaflet-fullscreen/Control.FullScreen.js index 54524de..91f535a 100644 --- a/assets/leaflet-fullscreen/Control.FullScreen.js +++ b/assets/leaflet-fullscreen/Control.FullScreen.js @@ -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; diff --git a/assets/leaflet-fullscreen/Control.FullScreen.min.js b/assets/leaflet-fullscreen/Control.FullScreen.min.js index 34a5c5d..314c372 100644 --- a/assets/leaflet-fullscreen/Control.FullScreen.min.js +++ b/assets/leaflet-fullscreen/Control.FullScreen.min.js @@ -1 +1 @@ -!function(){L.Control.FullScreen=L.Control.extend({options:{position:"topleft",title:"Full Screen",titleCancel:"Exit Full Screen",forceSeparateButton:!1,forcePseudoFullscreen:!1,fullscreenElement:!1},onAdd:function(e){var t,n="leaflet-control-zoom-fullscreen",l="";return t=e.zoomControl&&!this.options.forceSeparateButton?e.zoomControl._container:L.DomUtil.create("div","leaflet-bar"),this.options.content?l=this.options.content:n+=" fullscreen-icon",this._createButton(this.options.title,n,l,t,this.toggleFullScreen,this),this._map.on("enterFullscreen exitFullscreen",this._toggleTitle,this),t},_createButton:function(t,n,l,r,i,s){return this.link=L.DomUtil.create("a",n,r),this.link.href="#",this.link.title=t,this.link.innerHTML=l,L.DomEvent.addListener(this.link,"click",L.DomEvent.stopPropagation).addListener(this.link,"click",L.DomEvent.preventDefault).addListener(this.link,"click",i,s),L.DomEvent.addListener(r,e.fullScreenEventName,L.DomEvent.stopPropagation).addListener(r,e.fullScreenEventName,L.DomEvent.preventDefault).addListener(r,e.fullScreenEventName,this._handleEscKey,s),L.DomEvent.addListener(document,e.fullScreenEventName,L.DomEvent.stopPropagation).addListener(document,e.fullScreenEventName,L.DomEvent.preventDefault).addListener(document,e.fullScreenEventName,this._handleEscKey,s),this.link},toggleFullScreen:function(){var t=this._map;t._exitFired=!1,t._isFullscreen?(e.supportsFullScreen&&!this.options.forcePseudoFullscreen?e.cancelFullScreen(this.options.fullscreenElement?this.options.fullscreenElement:t._container):L.DomUtil.removeClass(t._container,"leaflet-pseudo-fullscreen"),t.invalidateSize(),t.fire("exitFullscreen"),t._exitFired=!0,t._isFullscreen=!1):(e.supportsFullScreen&&!this.options.forcePseudoFullscreen?e.requestFullScreen(this.options.fullscreenElement?this.options.fullscreenElement:t._container):L.DomUtil.addClass(t._container,"leaflet-pseudo-fullscreen"),t.invalidateSize(),t.fire("enterFullscreen"),t._isFullscreen=!0)},_toggleTitle:function(){this.link.title=this._map._isFullscreen?this.options.title:this.options.titleCancel},_handleEscKey:function(){var t=this._map;e.isFullScreen(t)||t._exitFired||(t.fire("exitFullscreen"),t._exitFired=!0,t._isFullscreen=!1)}}),L.Map.addInitHook(function(){this.options.fullscreenControl&&(this.fullscreenControl=L.control.fullscreen(this.options.fullscreenControlOptions),this.addControl(this.fullscreenControl))}),L.control.fullscreen=function(e){return new L.Control.FullScreen(e)};var e={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",prefix:""},t="webkit moz o ms khtml".split(" ");if(void 0!==document.exitFullscreen)e.supportsFullScreen=!0;else{for(var n=0,l=t.length;n Leaflet.Control.FullScreen Demo - + - + diff --git a/assets/leaflet-fullscreen/package.json b/assets/leaflet-fullscreen/package.json index bb9dab4..1b4c8f8 100644 --- a/assets/leaflet-fullscreen/package.json +++ b/assets/leaflet-fullscreen/package.json @@ -1,10 +1,10 @@ { "name": "leaflet.fullscreen", - "version": "1.4.3", + "version": "1.4.5", "description": "Simple plugin for Leaflet that adds fullscreen button to your maps.", "main": "Control.FullScreen.js", "scripts": { - "test": "jshint Control.FullScreen.js" + "test": "eslint --config .eslintrc Control.FullScreen.js" }, "repository": { "type": "git", diff --git a/module/config/config.php b/module/config/config.php index abf0d80..3e9ff6e 100644 --- a/module/config/config.php +++ b/module/config/config.php @@ -65,7 +65,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-loading'] = array $GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array ( 'name' => 'Leaflet.Control.FullScreen', - 'version' => '1.4.3', + 'version' => '1.4.5', 'license' => 'MIT', 'homepage' => 'https://github.com/brunob/leaflet.fullscreen', 'css' => 'assets/leaflet/libs/leaflet-fullscreen/Control.FullScreen.min.css',