Compare commits
	
		
			No commits in common. "f7ecd4326a91612b478d257ec1cc0a7dfe181b82" and "a783e6d889c2f6d6df7c89676d6183510f072f50" have entirely different histories.
		
	
	
		
			f7ecd4326a
			...
			a783e6d889
		
	
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -63,6 +63,7 @@
 | 
			
		||||
    <div class="modal">
 | 
			
		||||
        <div class="modal-background"></div>
 | 
			
		||||
        <div class="modal-content has-background-white">
 | 
			
		||||
            <!-- Any other Bulma elements you want -->
 | 
			
		||||
        </div>
 | 
			
		||||
        <button class="modal-close is-large" aria-label="close"></button>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@ -105,16 +105,13 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
 | 
			
		||||
            data = await GIS._fetchData(layer.id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // TODO: terrible!
 | 
			
		||||
        if (!layer.id.includes('area')) {
 | 
			
		||||
            const marker = L.marker(coords)
 | 
			
		||||
                .addTo(map)
 | 
			
		||||
                .bindTooltip(Object.keys(archeo).find(k => archeo[k] === layer))
 | 
			
		||||
                .openTooltip();
 | 
			
		||||
            
 | 
			
		||||
            if (typeof data === 'object') {
 | 
			
		||||
                marker.on('click', () => UI.openModal(data));
 | 
			
		||||
            }
 | 
			
		||||
        const marker = L.marker(coords)
 | 
			
		||||
            .addTo(map)
 | 
			
		||||
            .bindTooltip(Object.keys(archeo).find(k => archeo[k] === layer))
 | 
			
		||||
            .openTooltip();
 | 
			
		||||
        
 | 
			
		||||
        if (typeof data === 'object') {
 | 
			
		||||
            marker.on('click', () => UI.openModal(data));
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@ -131,14 +128,11 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
 | 
			
		||||
GIS.initLayers = async function(map) {
 | 
			
		||||
    let layerMater = await this.loadLayer('matermania.geojson', optionsSiti, false);
 | 
			
		||||
    let layerArsenale = await this.loadLayer('arsenale.geojson', optionsSiti, false);
 | 
			
		||||
    let layerArsenaleArea = await this.loadLayer('arsenale_area.geojson', optionsSiti, false);
 | 
			
		||||
    let layerGradola = await this.loadLayer('gradola.geojson', optionsSiti, false);
 | 
			
		||||
 | 
			
		||||
    layerMater.id = 'matermania';
 | 
			
		||||
    layerGradola.id = 'gradola';
 | 
			
		||||
    layerArsenale.id = 'arsenale';
 | 
			
		||||
    layerArsenaleArea.id = 'arsenale_area';
 | 
			
		||||
 | 
			
		||||
    let layerVincoli = await this.loadLayer('vincoli.geojson', optionsVincoli);
 | 
			
		||||
    // TODO named parameters??
 | 
			
		||||
    let layerPaesistici = await this.loadLayer('paesistici.geojson', optionsPaesistici);
 | 
			
		||||
@ -148,7 +142,7 @@ GIS.initLayers = async function(map) {
 | 
			
		||||
        attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    const sitesGroup = new L.LayerGroup([layerMater, layerGradola, layerArsenale, layerArsenaleArea]);
 | 
			
		||||
    const sitesGroup = new L.LayerGroup([layerMater, layerGradola, layerArsenale]);
 | 
			
		||||
    const baseGroup = new L.LayerGroup([osmap]);
 | 
			
		||||
    baseGroup.addTo(map);
 | 
			
		||||
    sitesGroup.addTo(map);
 | 
			
		||||
@ -158,8 +152,7 @@ GIS.initLayers = async function(map) {
 | 
			
		||||
    const archeo = {
 | 
			
		||||
        "Villa di Gradola" : layerGradola,
 | 
			
		||||
        "Grotta di Matermania" : layerMater,
 | 
			
		||||
        "Grotta dell'Arsenale (planimetria)" : layerArsenale,
 | 
			
		||||
        "Grotta dell'Arsenale (area)" : layerArsenaleArea,
 | 
			
		||||
        "Grotta dell'Arsenale" : layerArsenale,
 | 
			
		||||
        "Vincoli archeologici" : layerVincoli,
 | 
			
		||||
        "Vincoli paesistici" : layerPaesistici,
 | 
			
		||||
    };
 | 
			
		||||
							
								
								
									
										14
									
								
								js/index.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								js/index.js
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
			
		||||
import GIS from './gis.js';
 | 
			
		||||
import GIS from './caprigis.js';
 | 
			
		||||
import UI from './ui.js';
 | 
			
		||||
 | 
			
		||||
document.addEventListener('DOMContentLoaded', async () => {
 | 
			
		||||
@ -8,4 +8,14 @@ document.addEventListener('DOMContentLoaded', async () => {
 | 
			
		||||
    UI.addCenterMapControl(map, GIS.CENTER_COORDS, GIS.INIT_ZOOM);
 | 
			
		||||
    UI.toggleMenu('siti');
 | 
			
		||||
    UI.sitesMenu('.menu-list', map, sites);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
    for (let site of Object.keys(sites)) {
 | 
			
		||||
        if (!site.includes('Vincoli')) {
 | 
			
		||||
            let layer = sites[site];
 | 
			
		||||
            const centerCoords = layer.getBounds().getCenter();
 | 
			
		||||
            UI.addSitesControl(map, centerCoords, site, GIS.INIT_ZOOM);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    */
 | 
			
		||||
});
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
    "source": {
 | 
			
		||||
        "include": ["gis.js", "ui.js", "index.js"],
 | 
			
		||||
        "include": ["caprigis.js", "index.js"],
 | 
			
		||||
        "includePattern": ".js$",
 | 
			
		||||
        "excludePattern": "(vendor/|docs)"
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								js/ui.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								js/ui.js
									
									
									
									
									
								
							@ -6,9 +6,9 @@
 | 
			
		||||
const UI = {};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Add a Leaflet control to center the map
 | 
			
		||||
 * @param {Map} map The Leaflet map object
 | 
			
		||||
 * @param {LatLngExpression} centerCoords The coordinates to center the map
 | 
			
		||||
 * Add a control to center the map
 | 
			
		||||
 * @param {Map} map
 | 
			
		||||
 * @param {LatLngExpression} centerCoords
 | 
			
		||||
 * @param {number} zoom Zoom level
 | 
			
		||||
 */
 | 
			
		||||
UI.addCenterMapControl = function (map, centerCoords, zoom) {
 | 
			
		||||
@ -51,7 +51,7 @@ UI.toggleMenu = function (triggerId) {
 | 
			
		||||
		menu.classList.toggle('is-hidden');
 | 
			
		||||
		menu.classList.toggle('is-2');
 | 
			
		||||
		document.querySelector('#map').parentElement.classList.toggle('is-full');
 | 
			
		||||
	});
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Open a modal with DB data
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user