summaryrefslogtreecommitdiff
path: root/assets/static/vendor/leaflet-fullscreen
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--assets/static/vendor/leaflet-fullscreen/Control.FullScreen.css30
-rw-r--r--assets/static/vendor/leaflet-fullscreen/Control.FullScreen.umd.js299
2 files changed, 329 insertions, 0 deletions
diff --git a/assets/static/vendor/leaflet-fullscreen/Control.FullScreen.css b/assets/static/vendor/leaflet-fullscreen/Control.FullScreen.css
new file mode 100644
index 0000000..7bd117e
--- /dev/null
+++ b/assets/static/vendor/leaflet-fullscreen/Control.FullScreen.css
@@ -0,0 +1,30 @@
+:root {
+ --fullscreen-icon-enter: url('data:image/svg+xml,<svg viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M5 10.3V5.9c0-.5.4-.9.9-.9h4.4c.2 0 .4.2.4.4V7c0 .2-.2.4-.4.4h-3v3c0 .2-.2.4-.4.4H5.4a.4.4 0 0 1-.4-.4zm10.3-4.9V7c0 .2.2.4.4.4h3v3c0 .2.2.4.4.4h1.5c.2 0 .4-.2.4-.4V5.9c0-.5-.4-.9-.9-.9h-4.4c-.2 0-.4.2-.4.4zm5.3 9.9H19c-.2 0-.4.2-.4.4v3h-3c-.2 0-.4.2-.4.4v1.5c0 .2.2.4.4.4h4.4c.5 0 .9-.4.9-.9v-4.4c0-.2-.2-.4-.4-.4zm-9.9 5.3V19c0-.2-.2-.4-.4-.4h-3v-3c0-.2-.2-.4-.4-.4H5.4c-.2 0-.4.2-.4.4v4.4c0 .5.4.9.9.9h4.4c.2 0 .4-.2.4-.4z" fill="%23333"/></svg>');
+ --fullscreen-icon-exit: url('data:image/svg+xml,<svg viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M20.6 10.7H16a.9.9 0 0 1-.8-.8v-4.5c0-.2.2-.4.4-.4h1.4c.3 0 .5.2.5.4v3h3c.2 0 .4.2.4.5v1.4c0 .2-.2.4-.4.4zm-9.9-.8V5.4c0-.2-.2-.4-.4-.4H8.9c-.3 0-.5.2-.5.4v3h-3c-.2 0-.4.2-.4.5v1.4c0 .2.2.4.4.4H9.9c.4 0 .8-.4.8-.8zm0 10.7V16c0-.4-.4-.8-.8-.8H5.4c-.2 0-.4.2-.4.4v1.4c0 .3.2.5.4.5h3v3c0 .2.2.4.5.4h1.4c.2 0 .4-.2.4-.4zm6.9 0v-3h3c.2 0 .4-.2.4-.5v-1.4c0-.2-.2-.4-.4-.4H16c-.4 0-.8.4-.8.8v4.5c0 .2.2.4.4.4h1.5c.3 0 .5-.2.5-.4z" fill="%23333"/></svg>');
+}
+
+.leaflet-fullscreen-icon {
+ background-image: var(--fullscreen-icon-enter);
+ background-size: 26px 26px;
+}
+
+.leaflet-fullscreen-icon.leaflet-fullscreen-on {
+ background-image: var(--fullscreen-icon-exit);
+}
+
+/* Safari still needs this vendor-prefix: https://caniuse.com/mdn-css_selectors_fullscreen */
+.leaflet-container:-webkit-full-screen,
+.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: 0 !important;
+ left: 0 !important;
+ z-index: 99999;
+}
diff --git a/assets/static/vendor/leaflet-fullscreen/Control.FullScreen.umd.js b/assets/static/vendor/leaflet-fullscreen/Control.FullScreen.umd.js
new file mode 100644
index 0000000..91b081d
--- /dev/null
+++ b/assets/static/vendor/leaflet-fullscreen/Control.FullScreen.umd.js
@@ -0,0 +1,299 @@
+/*!
+ * leaflet.fullscreen
+ * (c) Bruno B.; MIT License
+ * https://github.com/brunob/leaflet.fullscreen
+ */
+/*! GENERATED FILE - DO NOT EDIT DIRECTLY. Edit files in src/ and run 'npm run build' */
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('leaflet')) :
+ typeof define === 'function' && define.amd ? define(['leaflet'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.L = global.L || {}, global.L.Control = global.L.Control || {}, global.L.Control.FullScreen = factory(global.L)));
+})(this, (function (leaflet) { 'use strict';
+
+ if (typeof document === 'undefined') {
+ console.warn('"window.document" is undefined; leaflet.fullscreen requires this object to access the DOM');
+ }
+
+ const nativeAPI = (() => {
+ const methodMap = [
+ // Standard
+ [
+ 'requestFullscreen',
+ 'exitFullscreen',
+ 'fullscreenElement',
+ 'fullscreenEnabled',
+ 'fullscreenchange',
+ 'fullscreenerror'
+ ],
+ // New WebKit
+ [
+ 'webkitRequestFullscreen',
+ 'webkitExitFullscreen',
+ 'webkitFullscreenElement',
+ 'webkitFullscreenEnabled',
+ 'webkitfullscreenchange',
+ 'webkitfullscreenerror'
+ ]
+ ];
+
+ const baseList = methodMap[0];
+ const ret = {};
+
+ for (const methodList of methodMap) {
+ if (methodList[1] in document) {
+ for (let i = 0; i < methodList.length; i++) {
+ ret[baseList[i]] = methodList[i];
+ }
+ return ret;
+ }
+ }
+
+ return false;
+ })();
+
+ const eventNameMap = {
+ change: nativeAPI.fullscreenchange,
+ error: nativeAPI.fullscreenerror,
+ };
+
+ const fullscreenAPI = {
+ // Request fullscreen for a specific element
+ async request(element, options) {
+ element = element || document.documentElement;
+ const requestMethod = nativeAPI.requestFullscreen;
+
+ await this._callNative(() => {
+ return element[requestMethod](options);
+ });
+ },
+ // Exit fullscreen mode
+ async exit() {
+ if (!this.isFullscreen) {
+ return;
+ }
+ const exitMethod = nativeAPI.exitFullscreen;
+
+ await this._callNative(() => {
+ return document[exitMethod]();
+ });
+ },
+ // Helper to handle browser differences (Promise vs Event)
+ async _callNative(action) {
+ const result = action();
+
+ // Modern browsers return a Promise from requestFullscreen/exitFullscreen
+ if (result instanceof Promise) {
+ await result;
+ return;
+ }
+
+ // Fallback for Safari < 16.4 (March 2023) which doesn't return a Promise
+ await new Promise((resolve) => {
+ const listener = () => {
+ this.off('change', listener);
+ resolve();
+ };
+ this.on('change', listener);
+ });
+ },
+ // Add event listener for fullscreen changes
+ on(event, callback) {
+ const eventName = eventNameMap[event];
+ if (eventName) {
+ document.addEventListener(eventName, callback);
+ }
+ },
+ // Remove event listener
+ off(event, callback) {
+ const eventName = eventNameMap[event];
+ if (eventName) {
+ document.removeEventListener(eventName, callback);
+ }
+ },
+ nativeAPI: nativeAPI
+ };
+
+ Object.defineProperties(fullscreenAPI, {
+ isFullscreen: {
+ get() {
+ return Boolean(document[nativeAPI.fullscreenElement]);
+ }
+ },
+ isEnabled: {
+ enumerable: true,
+ get() {
+ // Coerce to boolean in case of old WebKit
+ return Boolean(document[nativeAPI.fullscreenEnabled]);
+ }
+ }
+ });
+
+ const FullScreen = leaflet.Control.extend({
+ options: {
+ position: 'topleft',
+ title: 'Full Screen',
+ titleCancel: 'Exit Full Screen',
+ forceSeparateButton: false,
+ forcePseudoFullscreen: false,
+ fullscreenElement: false
+ },
+
+ _screenfull: fullscreenAPI,
+
+ onAdd(map) {
+ let className = 'leaflet-control-zoom-fullscreen';
+ let container;
+ let content = '';
+
+ if (map.zoomControl && !this.options.forceSeparateButton) {
+ container = map.zoomControl._container;
+ } else {
+ container = document.createElement('div');
+ container.className = 'leaflet-bar';
+ }
+
+ if (this.options.content) {
+ content = this.options.content;
+ } else {
+ className += ' leaflet-fullscreen-icon';
+ }
+
+ this._createButton(this.options.title, className, content, container, this.toggleFullScreen, this);
+ this._map.fullscreenControl = this;
+
+ this._map.on('enterFullscreen exitFullscreen', this._toggleState, this);
+
+ return container;
+ },
+
+ onRemove() {
+ leaflet.DomEvent
+ .off(this.link, 'click', leaflet.DomEvent.stop)
+ .off(this.link, 'click', this.toggleFullScreen, this);
+
+ if (this._screenfull.isEnabled) {
+ leaflet.DomEvent
+ .off(document, this._screenfull.nativeAPI.fullscreenchange, leaflet.DomEvent.stop)
+ .off(document, this._screenfull.nativeAPI.fullscreenchange, this._handleFullscreenChange, this);
+ }
+ },
+
+ _createButton(title, className, content, container, fn, context) {
+ this.link = document.createElement('a');
+ this.link.className = className;
+ container.appendChild(this.link);
+ this.link.href = '#';
+ this.link.title = title;
+ this.link.innerHTML = content;
+
+ this.link.setAttribute('role', 'button');
+ this.link.setAttribute('aria-label', title);
+
+ leaflet.DomEvent.disableClickPropagation(container);
+
+ leaflet.DomEvent
+ .on(this.link, 'click', leaflet.DomEvent.stop)
+ .on(this.link, 'click', fn, context);
+
+ if (this._screenfull.isEnabled) {
+ leaflet.DomEvent
+ .on(document, this._screenfull.nativeAPI.fullscreenchange, leaflet.DomEvent.stop)
+ .on(document, this._screenfull.nativeAPI.fullscreenchange, this._handleFullscreenChange, context);
+ }
+
+ return this.link;
+ },
+
+ async toggleFullScreen() {
+ const map = this._map;
+ const { fullscreenElement, forcePseudoFullscreen } = this.options;
+
+ // Target element: use custom element if provided, otherwise the map container
+ const container = fullscreenElement || map.getContainer();
+
+ // Check if we should use the native Fullscreen API
+ const useNative = this._screenfull.isEnabled && !forcePseudoFullscreen;
+
+ if (map._isFullscreen) {
+ // --- EXIT FULLSCREEN ---
+
+ // Set flag to prevent the 'fullscreenchange' listener from firing a duplicate exit event
+ map._exitFired = true;
+
+ if (useNative) {
+ await this._screenfull.exit();
+ } else {
+ container.classList.remove('leaflet-pseudo-fullscreen');
+ }
+
+ map.invalidateSize();
+ map._isFullscreen = false;
+ map.fire('exitFullscreen');
+ } else {
+ // --- ENTER FULLSCREEN ---
+
+ map._exitFired = false;
+
+ if (useNative) {
+ await this._screenfull.request(container);
+ } else {
+ container.classList.add('leaflet-pseudo-fullscreen');
+ }
+
+ map.invalidateSize();
+ map._isFullscreen = true;
+ map.fire('enterFullscreen');
+ }
+ },
+
+ _toggleState() {
+ const { title, titleCancel } = this.options;
+ const isFullscreen = this._map._isFullscreen;
+
+ // Update Title & Aria Label
+ this.link.title = isFullscreen ? titleCancel : title;
+ this.link.setAttribute('aria-label', this.link.title);
+ this.link.setAttribute('aria-pressed', isFullscreen.toString());
+
+ // Update Icon Class
+ this.link.classList.toggle('leaflet-fullscreen-on', isFullscreen);
+ },
+
+ _handleFullscreenChange() {
+ const map = this._map;
+
+ // Check if fullscreen was exited via browser (ESC key or browser UI)
+ // and we didn't trigger the exit ourselves
+ const wasExitedExternally = !this._screenfull.isFullscreen && map._isFullscreen && !map._exitFired;
+
+ if (wasExitedExternally) {
+ // Sync internal state with browser state
+ map._exitFired = true;
+ map._isFullscreen = false;
+
+ // Notify listeners and adjust map size
+ map.fire('exitFullscreen');
+ map.invalidateSize();
+ }
+ }
+ });
+
+ leaflet.Map.include({
+ toggleFullscreen() {
+ this.fullscreenControl.toggleFullScreen();
+ }
+ });
+
+ leaflet.Map.mergeOptions({
+ fullscreenControl: false
+ });
+
+ leaflet.Map.addInitHook(function() {
+ if (this.options.fullscreenControl) {
+ this.addControl(new FullScreen(this.options.fullscreenControlOptions));
+ }
+ });
+
+ return FullScreen;
+
+}));