forked from Snck3rs/contao-leaflet-libraries
Update leaflet fullscreen.
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
|
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
|
||||||
.leaflet-retina .fullscreen-icon { background-image: url(icon-fullscreen-2x.png); background-size: 26px 26px; }
|
.leaflet-retina .fullscreen-icon { background-image: url(icon-fullscreen-2x.png); background-size: 26px 26px; }
|
||||||
|
/* one selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
|
||||||
.leaflet-container:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
.leaflet-container:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
||||||
|
.leaflet-container:-ms-fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
||||||
|
.leaflet-container:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
||||||
|
.leaflet-container:fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
||||||
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }
|
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }
|
||||||
37
assets/leaflet-fullscreen/Control.FullScreen.js
vendored
37
assets/leaflet-fullscreen/Control.FullScreen.js
vendored
@@ -6,7 +6,8 @@ L.Control.FullScreen = L.Control.extend({
|
|||||||
title: 'Full Screen',
|
title: 'Full Screen',
|
||||||
titleCancel: 'Exit Full Screen',
|
titleCancel: 'Exit Full Screen',
|
||||||
forceSeparateButton: false,
|
forceSeparateButton: false,
|
||||||
forcePseudoFullscreen: false
|
forcePseudoFullscreen: false,
|
||||||
|
fullscreenElement: false
|
||||||
},
|
},
|
||||||
|
|
||||||
onAdd: function (map) {
|
onAdd: function (map) {
|
||||||
@@ -60,7 +61,7 @@ L.Control.FullScreen = L.Control.extend({
|
|||||||
map._exitFired = false;
|
map._exitFired = false;
|
||||||
if (map._isFullscreen) {
|
if (map._isFullscreen) {
|
||||||
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
|
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
|
||||||
fullScreenApi.cancelFullScreen(map._container);
|
fullScreenApi.cancelFullScreen(this.options.fullscreenElement ? this.options.fullscreenElement : map._container);
|
||||||
} else {
|
} else {
|
||||||
L.DomUtil.removeClass(map._container, 'leaflet-pseudo-fullscreen');
|
L.DomUtil.removeClass(map._container, 'leaflet-pseudo-fullscreen');
|
||||||
}
|
}
|
||||||
@@ -71,7 +72,7 @@ L.Control.FullScreen = L.Control.extend({
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
|
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
|
||||||
fullScreenApi.requestFullScreen(map._container);
|
fullScreenApi.requestFullScreen(this.options.fullscreenElement ? this.options.fullscreenElement : map._container);
|
||||||
} else {
|
} else {
|
||||||
L.DomUtil.addClass(map._container, 'leaflet-pseudo-fullscreen');
|
L.DomUtil.addClass(map._container, 'leaflet-pseudo-fullscreen');
|
||||||
}
|
}
|
||||||
@@ -138,26 +139,50 @@ source : http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugi
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (typeof document['msExitFullscreen'] !== 'undefined') {
|
||||||
|
fullScreenApi.prefix = 'ms';
|
||||||
|
fullScreenApi.supportsFullScreen = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update methods to do something useful
|
// update methods to do something useful
|
||||||
if (fullScreenApi.supportsFullScreen) {
|
if (fullScreenApi.supportsFullScreen) {
|
||||||
|
if (fullScreenApi.prefix === 'ms') {
|
||||||
|
fullScreenApi.fullScreenEventName = 'MSFullscreenChange';
|
||||||
|
} else {
|
||||||
fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange';
|
fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange';
|
||||||
|
}
|
||||||
fullScreenApi.isFullScreen = function () {
|
fullScreenApi.isFullScreen = function () {
|
||||||
switch (this.prefix) {
|
switch (this.prefix) {
|
||||||
case '':
|
case '':
|
||||||
return document.fullScreen;
|
return document.fullScreen;
|
||||||
case 'webkit':
|
case 'webkit':
|
||||||
return document.webkitIsFullScreen;
|
return document.webkitIsFullScreen;
|
||||||
|
case 'ms':
|
||||||
|
return document.msFullscreenElement;
|
||||||
default:
|
default:
|
||||||
return document[this.prefix + 'FullScreen'];
|
return document[this.prefix + 'FullScreen'];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fullScreenApi.requestFullScreen = function (el) {
|
fullScreenApi.requestFullScreen = function (el) {
|
||||||
return (this.prefix === '') ? el.requestFullscreen() : el[this.prefix + 'RequestFullScreen']();
|
switch (this.prefix) {
|
||||||
|
case '':
|
||||||
|
return el.requestFullscreen();
|
||||||
|
case 'ms':
|
||||||
|
return el.msRequestFullscreen();
|
||||||
|
default:
|
||||||
|
return el[this.prefix + 'RequestFullScreen']();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
fullScreenApi.cancelFullScreen = function(el) {
|
fullScreenApi.cancelFullScreen = function () {
|
||||||
return (this.prefix === '') ? document.exitFullscreen() : document[this.prefix + 'CancelFullScreen']();
|
switch (this.prefix) {
|
||||||
|
case '':
|
||||||
|
return document.exitFullscreen();
|
||||||
|
case 'ms':
|
||||||
|
return document.msExitFullscreen();
|
||||||
|
default:
|
||||||
|
return document[this.prefix + 'CancelFullScreen']();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
.fullscreen-icon{background-image:url('icon-fullscreen.png')}.leaflet-retina .fullscreen-icon{background-image:url('icon-fullscreen-2x.png');background-size:26px 26px}.leaflet-container:-webkit-full-screen{width:100%!important;height:100%!important;z-index:99999}.leaflet-pseudo-fullscreen{position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}
|
.leaflet-container:full-screen,.leaflet-pseudo-fullscreen{width:100%!important;height:100%!important;z-index:99999}.fullscreen-icon{background-image:url('icon-fullscreen.png')}.leaflet-retina .fullscreen-icon{background-image:url('icon-fullscreen-2x.png');background-size:26px 26px}.leaflet-container:-webkit-full-screen{width:100%!important;height:100%!important;z-index:99999}.leaflet-container:-ms-fullscreen{width:100%!important;height:100%!important;z-index:99999}.leaflet-container:fullscreen{width:100%!important;height:100%!important;z-index:99999}.leaflet-pseudo-fullscreen{position:fixed!important;top:0!important;left:0!important}
|
||||||
@@ -1 +1 @@
|
|||||||
!function(){L.Control.FullScreen=L.Control.extend({options:{position:"topleft",title:"Full Screen",titleCancel:"Exit Full Screen",forceSeparateButton:!1,forcePseudoFullscreen:!1},onAdd:function(e){var n,t="leaflet-control-zoom-fullscreen",l="";return n=e.zoomControl&&!this.options.forceSeparateButton?e.zoomControl._container:L.DomUtil.create("div","leaflet-bar"),this.options.content?l=this.options.content:t+=" fullscreen-icon",this._createButton(this.options.title,t,l,n,this.toggleFullScreen,this),this._map.on("enterFullscreen exitFullscreen",this._toggleTitle,this),n},_createButton:function(n,t,l,r,i,o){return this.link=L.DomUtil.create("a",t,r),this.link.href="#",this.link.title=n,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,o),L.DomEvent.addListener(r,e.fullScreenEventName,L.DomEvent.stopPropagation).addListener(r,e.fullScreenEventName,L.DomEvent.preventDefault).addListener(r,e.fullScreenEventName,this._handleEscKey,o),L.DomEvent.addListener(document,e.fullScreenEventName,L.DomEvent.stopPropagation).addListener(document,e.fullScreenEventName,L.DomEvent.preventDefault).addListener(document,e.fullScreenEventName,this._handleEscKey,o),this.link},toggleFullScreen:function(){var n=this._map;n._exitFired=!1,n._isFullscreen?(e.supportsFullScreen&&!this.options.forcePseudoFullscreen?e.cancelFullScreen(n._container):L.DomUtil.removeClass(n._container,"leaflet-pseudo-fullscreen"),n.invalidateSize(),n.fire("exitFullscreen"),n._exitFired=!0,n._isFullscreen=!1):(e.supportsFullScreen&&!this.options.forcePseudoFullscreen?e.requestFullScreen(n._container):L.DomUtil.addClass(n._container,"leaflet-pseudo-fullscreen"),n.invalidateSize(),n.fire("enterFullscreen"),n._isFullscreen=!0)},_toggleTitle:function(){this.link.title=this._map._isFullscreen?this.options.title:this.options.titleCancel},_handleEscKey:function(){var n=this._map;e.isFullScreen(n)||n._exitFired||(n.fire("exitFullscreen"),n._exitFired=!0,n._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:""},n="webkit moz o ms khtml".split(" ");if("undefined"!=typeof document.exitFullscreen)e.supportsFullScreen=!0;else for(var t=0,l=n.length;l>t;t++)if(e.prefix=n[t],"undefined"!=typeof document[e.prefix+"CancelFullScreen"]){e.supportsFullScreen=!0;break}e.supportsFullScreen&&(e.fullScreenEventName=e.prefix+"fullscreenchange",e.isFullScreen=function(){switch(this.prefix){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;default:return document[this.prefix+"FullScreen"]}},e.requestFullScreen=function(e){return""===this.prefix?e.requestFullscreen():e[this.prefix+"RequestFullScreen"]()},e.cancelFullScreen=function(){return""===this.prefix?document.exitFullscreen():document[this.prefix+"CancelFullScreen"]()}),"undefined"!=typeof jQuery&&(jQuery.fn.requestFullScreen=function(){return this.each(function(){var n=jQuery(this);e.supportsFullScreen&&e.requestFullScreen(n)})}),window.fullScreenApi=e}();
|
!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 n,t="leaflet-control-zoom-fullscreen",l="";return n=e.zoomControl&&!this.options.forceSeparateButton?e.zoomControl._container:L.DomUtil.create("div","leaflet-bar"),this.options.content?l=this.options.content:t+=" fullscreen-icon",this._createButton(this.options.title,t,l,n,this.toggleFullScreen,this),this._map.on("enterFullscreen exitFullscreen",this._toggleTitle,this),n},_createButton:function(n,t,l,r,i,s){return this.link=L.DomUtil.create("a",t,r),this.link.href="#",this.link.title=n,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 n=this._map;n._exitFired=!1,n._isFullscreen?(e.supportsFullScreen&&!this.options.forcePseudoFullscreen?e.cancelFullScreen(this.options.fullscreenElement?this.options.fullscreenElement:n._container):L.DomUtil.removeClass(n._container,"leaflet-pseudo-fullscreen"),n.invalidateSize(),n.fire("exitFullscreen"),n._exitFired=!0,n._isFullscreen=!1):(e.supportsFullScreen&&!this.options.forcePseudoFullscreen?e.requestFullScreen(this.options.fullscreenElement?this.options.fullscreenElement:n._container):L.DomUtil.addClass(n._container,"leaflet-pseudo-fullscreen"),n.invalidateSize(),n.fire("enterFullscreen"),n._isFullscreen=!0)},_toggleTitle:function(){this.link.title=this._map._isFullscreen?this.options.title:this.options.titleCancel},_handleEscKey:function(){var n=this._map;e.isFullScreen(n)||n._exitFired||(n.fire("exitFullscreen"),n._exitFired=!0,n._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:""},n="webkit moz o ms khtml".split(" ");if("undefined"!=typeof document.exitFullscreen)e.supportsFullScreen=!0;else{for(var t=0,l=n.length;t<l;t++)if(e.prefix=n[t],"undefined"!=typeof document[e.prefix+"CancelFullScreen"]){e.supportsFullScreen=!0;break}"undefined"!=typeof document.msExitFullscreen&&(e.prefix="ms",e.supportsFullScreen=!0)}e.supportsFullScreen&&("ms"===e.prefix?e.fullScreenEventName="MSFullscreenChange":e.fullScreenEventName=e.prefix+"fullscreenchange",e.isFullScreen=function(){switch(this.prefix){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;case"ms":return document.msFullscreenElement;default:return document[this.prefix+"FullScreen"]}},e.requestFullScreen=function(e){switch(this.prefix){case"":return e.requestFullscreen();case"ms":return e.msRequestFullscreen();default:return e[this.prefix+"RequestFullScreen"]()}},e.cancelFullScreen=function(){switch(this.prefix){case"":return document.exitFullscreen();case"ms":return document.msExitFullscreen();default:return document[this.prefix+"CancelFullScreen"]()}}),"undefined"!=typeof jQuery&&(jQuery.fn.requestFullScreen=function(){return this.each(function(){var n=jQuery(this);e.supportsFullScreen&&e.requestFullScreen(n)})}),window.fullScreenApi=e}();
|
||||||
@@ -47,7 +47,8 @@ L.control.fullscreen({
|
|||||||
titleCancel: 'Exit fullscreen mode' // change the title of the button when fullscreen is on, default Exit Full Screen
|
titleCancel: 'Exit fullscreen mode' // change the title of the button when fullscreen is on, default Exit Full Screen
|
||||||
content: null // change the content of the button, can be HTML, default null
|
content: null // change the content of the button, can be HTML, default null
|
||||||
forceSeparateButton: true, // force seperate button to detach from zoom buttons, default false
|
forceSeparateButton: true, // force seperate button to detach from zoom buttons, default false
|
||||||
forcePseudoFullscreen: true // force use of pseudo full screen even if full screen API is available, default false
|
forcePseudoFullscreen: true, // force use of pseudo full screen even if full screen API is available, default false
|
||||||
|
fullscreenElement: false // Dom element to render in full screen, false by default, fallback to map._container
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
// events are fired when entering or exiting fullscreen.
|
// events are fired when entering or exiting fullscreen.
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "leaflet.fullscreen",
|
"name": "leaflet.fullscreen",
|
||||||
"version": "1.3.0",
|
"version": "1.4.2",
|
||||||
"homepage": "https://github.com/brunob/leaflet.fullscreen",
|
"homepage": "https://github.com/brunob/leaflet.fullscreen",
|
||||||
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [
|
||||||
"brunob <brunobergot@gmail.com>"
|
"brunob <brunobergot@gmail.com>"
|
||||||
],
|
],
|
||||||
@@ -12,13 +13,15 @@
|
|||||||
"icon-fullscreen.png",
|
"icon-fullscreen.png",
|
||||||
"icon-fullscreen-2x.png"
|
"icon-fullscreen-2x.png"
|
||||||
],
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "2.3.0"
|
||||||
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"leaflet",
|
"leaflet",
|
||||||
"plugins",
|
"plugins",
|
||||||
"maps",
|
"maps",
|
||||||
"fullscreen"
|
"fullscreen"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"**/.*",
|
"**/.*",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 215 B |
Binary file not shown.
|
Before Width: | Height: | Size: 153 B After Width: | Height: | Size: 139 B |
@@ -3,17 +3,18 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset='utf-8'>
|
<meta charset='utf-8'>
|
||||||
<title>Leaflet.Control.FullScreen Demo</title>
|
<title>Leaflet.Control.FullScreen Demo</title>
|
||||||
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.css" />
|
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#map { width: 700px; height: 433px; }
|
#map { width: 700px; height: 433px; }
|
||||||
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
|
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
|
||||||
/* on selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
|
/* one selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
|
||||||
#map:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
#map:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
||||||
#map:-moz-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
#map:-ms-fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
||||||
#map:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
#map:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
||||||
|
#map:fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
|
||||||
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }
|
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }
|
||||||
</style>
|
</style>
|
||||||
<script src="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.js"></script>
|
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
|
||||||
<script src="Control.FullScreen.js"></script>
|
<script src="Control.FullScreen.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "leaflet.fullscreen",
|
"name": "leaflet.fullscreen",
|
||||||
"version": "1.3.0",
|
"version": "1.4.2",
|
||||||
"description": "Simple plugin for Leaflet that adds fullscreen button to your maps.",
|
"description": "Simple plugin for Leaflet that adds fullscreen button to your maps.",
|
||||||
"main": "Control.FullScreen.js",
|
"main": "Control.FullScreen.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
"fullscreen"
|
"fullscreen"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jshint": "2.5.0"
|
"eslint": "2.3.0"
|
||||||
},
|
},
|
||||||
"author": "b_b",
|
"author": "b_b",
|
||||||
"license": "MIT License",
|
"license": "MIT License",
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-loading'] = array
|
|||||||
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array
|
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array
|
||||||
(
|
(
|
||||||
'name' => 'Leaflet.Control.FullScreen',
|
'name' => 'Leaflet.Control.FullScreen',
|
||||||
'version' => '1.3.0',
|
'version' => '1.4.2',
|
||||||
'license' => '<a href="https://github.com/brunob/leaflet.fullscreen/blob/master/LICENSE" target="_blank">MIT</a>',
|
'license' => '<a href="https://github.com/brunob/leaflet.fullscreen/blob/master/LICENSE" target="_blank">MIT</a>',
|
||||||
'homepage' => 'https://github.com/brunob/leaflet.fullscreen',
|
'homepage' => 'https://github.com/brunob/leaflet.fullscreen',
|
||||||
'css' => 'assets/leaflet/libs/leaflet-fullscreen/Control.FullScreen.min.css',
|
'css' => 'assets/leaflet/libs/leaflet-fullscreen/Control.FullScreen.min.css',
|
||||||
|
|||||||
Reference in New Issue
Block a user