Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Control.FullScreen.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
.leaflet-retina .fullscreen-icon { background-image: url(icon-fullscreen-2x.png); background-size: 26px 26px; }
.fullscreen-icon { background-image: url(icon-fullscreen.svg); background-size:26px 52px; }
.fullscreen-icon.leaflet-fullscreen-on { background-position:0 -26px; }
.leaflet-touch .fullscreen-icon { background-position: 2px 2px; }
.leaflet-touch .fullscreen-icon.leaflet-fullscreen-on { background-position: 2px -24px; }
/* 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:-ms-fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
Expand Down
5 changes: 3 additions & 2 deletions Control.FullScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
this._createButton(this.options.title, className, content, container, this.toggleFullScreen, this);
this._map.fullscreenControl = this;

this._map.on('enterFullscreen exitFullscreen', this._toggleTitle, this);
this._map.on('enterFullscreen exitFullscreen', this._toggleState, this);

return container;
},
Expand Down Expand Up @@ -306,8 +306,9 @@
}
},

_toggleTitle: function () {
_toggleState: function () {
this.link.title = this._map._isFullscreen ? this.options.title : this.options.titleCancel;
this._map._isFullscreen ? L.DomUtil.removeClass(this.link, 'leaflet-fullscreen-on') : L.DomUtil.addClass(this.link, 'leaflet-fullscreen-on');
},

_handleFullscreenChange: function () {
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Inspired by http://elidupuis.github.com/leaflet.zoomfs/

Use the native javascript fullscreen API with help of https://github.com/sindresorhus/screenfull.js

Icons from [Font Awesome v5.15.4](https://github.com/FortAwesome/Font-Awesome/releases/tag/5.15.4): [Creative Commons Attribution 4.0](https://fontawesome.com/license/free)

Released under the MIT License http://opensource.org/licenses/mit-license.php

How ?
Expand Down
Binary file removed icon-fullscreen-2x.png
Binary file not shown.
Binary file removed icon-fullscreen.png
Binary file not shown.
1 change: 1 addition & 0 deletions icon-fullscreen.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 3 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
<head>
<meta charset='utf-8'>
<title>Leaflet.Control.FullScreen Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@latest/dist/leaflet.css" />
<link rel="stylesheet" href="Control.FullScreen.css" />
<style type="text/css">
#map { width: 700px; height: 433px; }
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
.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:-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; }
#map { width: 700px; max-width: 100%; height: 433px; }
</style>
<script src="https://unpkg.com/leaflet@latest/dist/leaflet.js"></script>
<script src="Control.FullScreen.js"></script>
Expand Down