From 779c441ecc24d11b151a6c713ef70e2f504067bf Mon Sep 17 00:00:00 2001 From: loviuz Date: Sun, 30 Jun 2024 14:48:45 +0200 Subject: [PATCH] Aggiunta plugin LeafletJS per mappe a schermo intero --- assets/src/css/style.css | 4 ++++ gulpfile.js | 6 ++++++ modules/anagrafiche/edit.php | 15 +++++++++++++-- modules/anagrafiche/modals/posizione.php | 13 ++++++++++++- modules/interventi/header.php | 15 +++++++++++++-- package.json | 1 + 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/assets/src/css/style.css b/assets/src/css/style.css index e5839d6c5..757b4cbc2 100755 --- a/assets/src/css/style.css +++ b/assets/src/css/style.css @@ -1625,6 +1625,10 @@ body:not(.sidebar-collapse) .sidebar .nav-treeview .nav-treeview .nav-link { padding: 0 5px; } +.fullscreen-icon { + background-image: url('../img/leaflet/icon-fullscreen.svg'); +} + @media screen and (max-width: 767px) { .navbar-left { display: inline-block; diff --git a/gulpfile.js b/gulpfile.js index 5e1fdd887..6694ab806 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -123,6 +123,7 @@ const JS = gulp.parallel(() => { 'bootstrap-maxlength/dist/bootstrap-maxlength.js', 'leaflet/dist/leaflet.js', 'leaflet-gesture-handling/dist/leaflet-gesture-handling.min.js', + 'leaflet.fullscreen/Control.FullScreen.js', 'ismobilejs/dist/isMobile.min.js', 'ua-parser-js/dist/ua-parser.min.js', ]; @@ -184,6 +185,7 @@ const CSS = gulp.parallel(() => { 'smartwizard/dist/css/smart_wizard_theme_arrows.min.css', 'leaflet-gesture-handling/dist/leaflet-gesture-handling.min.css', 'leaflet/dist/leaflet.css', + 'leaflet.fullscreen/Control.FullScreen.css', '@ttskch/select2-bootstrap4-theme/dist/select2-bootstrap4.min.css' ]; @@ -252,6 +254,10 @@ function srcImages() { } function leaflet() { + gulp.src([ + config.nodeDirectory + '/leaflet.fullscreen/icon-fullscreen.svg', + ]).pipe(gulp.dest(config.production + '/' + config.paths.images + '/leaflet')); + return gulp.src([ config.nodeDirectory + '/leaflet/dist/images/*.{jpg,png,jpeg}', ]) diff --git a/modules/anagrafiche/edit.php b/modules/anagrafiche/edit.php index 343d5186b..c66bbdc97 100755 --- a/modules/anagrafiche/edit.php +++ b/modules/anagrafiche/edit.php @@ -387,7 +387,7 @@ echo ' L.tileLayer("'.setting('Tile server OpenStreetMap').'", { maxZoom: 17, attribution: "© OpenStreetMap" - }).addTo(map); + }).addTo(map); } var icon = new L.Icon({ @@ -402,8 +402,19 @@ echo ' var marker = L.marker([lat, lng], { icon: icon }).addTo(map); + + L.control + .fullscreen({ + position: "topright", + title: "'.tr('Vai a schermo intero').'", + titleCancel: "'.tr('Esci dalla modalità schermo intero').'", + content: null, + forceSeparateButton: true, + forcePseudoFullscreen: true, + fullscreenElement: false + }).addTo(map); - map.setView([lat, lng], 10); + map.setView([lat, lng], 14); } function risolviConto(tipo){ diff --git a/modules/anagrafiche/modals/posizione.php b/modules/anagrafiche/modals/posizione.php index 54c2fcf57..64b32213f 100644 --- a/modules/anagrafiche/modals/posizione.php +++ b/modules/anagrafiche/modals/posizione.php @@ -159,7 +159,18 @@ function caricaMappa() { icon: icon }).addTo(map); - map.setView([lat, lng], 10); + L.control + .fullscreen({ + position: "topright", + title: "'.tr('Vai a schermo intero').'", + titleCancel: "'.tr('Esci dalla modalità schermo intero').'", + content: null, + forceSeparateButton: true, + forcePseudoFullscreen: true, + fullscreenElement: false + }).addTo(map); + + map.setView([lat, lng], 14); map.on("click", function(e) { marker.setLatLng(e.latlng); diff --git a/modules/interventi/header.php b/modules/interventi/header.php index 81f833311..666dac446 100644 --- a/modules/interventi/header.php +++ b/modules/interventi/header.php @@ -244,7 +244,7 @@ if (!empty($sede_cliente->gaddress) || (!empty($sede_cliente->lat) && !empty($se
'; // Navigazione diretta verso l'indirizzo echo ' - + '.tr('Carica mappa').'
@@ -359,7 +359,18 @@ echo ' map = L.map("map-edit", { gestureHandling: true }); - + + L.control + .fullscreen({ + position: "topright", + title: "'.tr('Vai a schermo intero').'", + titleCancel: "'.tr('Esci dalla modalità schermo intero').'", + content: null, + forceSeparateButton: true, + forcePseudoFullscreen: true, + fullscreenElement: false + }).addTo(map); + L.tileLayer("'.setting('Tile server OpenStreetMap').'", { maxZoom: 17, attribution: "© OpenStreetMap" diff --git a/package.json b/package.json index b9c599c0e..3f242855e 100755 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "jquery.shorten": "^1.0.0", "leaflet": "^1.9.4", "leaflet-gesture-handling": "^1.2.2", + "leaflet.fullscreen": "^3.0.2", "moment": "^2.18.1", "numeral": "^2.0.6", "parsleyjs": "^2.7.2",