82 lines
1.8 KiB
JavaScript
82 lines
1.8 KiB
JavaScript
// Global leaflet
|
|
|
|
// See app.css - Building tech colors
|
|
const buildingTechColors = {
|
|
"Opera cementizia" : "cement-tech",
|
|
"Opera poligonale" : "polygon-tech",
|
|
"Opera incerta" : "uncertain-tech",
|
|
"Opera reticolata" : "reticul-tech",
|
|
"Opera laterizia" : "later-tech",
|
|
"Opera mista" : "mixed-tech",
|
|
};
|
|
/**
|
|
* @namespace Icons
|
|
*/
|
|
const Icons = {};
|
|
|
|
Icons.site = L.icon(
|
|
{
|
|
iconUrl: 'img/icons/siti.png',
|
|
iconSize: [18, 27],
|
|
iconAnchor: [10, 24],
|
|
tooltipAnchor: [0, -22],
|
|
}
|
|
);
|
|
Icons.notConserved = L.icon(
|
|
{
|
|
iconUrl: 'img/icons/non_conserv.png',
|
|
iconSize: [18, 27],
|
|
iconAnchor: [10, 24],
|
|
tooltipAnchor: [0, -22],
|
|
}
|
|
);
|
|
|
|
Icons.finding = L.icon(
|
|
{
|
|
iconUrl: 'img/icons/rinvenimenti.png',
|
|
iconSize: [18, 27],
|
|
iconAnchor: [10, 24],
|
|
tooltipAnchor: [0, -22],
|
|
}
|
|
);
|
|
|
|
Icons.prehistoric = L.icon(
|
|
{
|
|
iconUrl: 'img/icons/preistorici.png',
|
|
iconSize: [18, 27],
|
|
iconAnchor: [10, 24],
|
|
tooltipAnchor: [0, -22],
|
|
}
|
|
);
|
|
|
|
Icons.underwater = L.icon(
|
|
{
|
|
iconUrl: 'img/icons/subacquei.png',
|
|
iconSize: [18, 27],
|
|
iconAnchor: [10, 24],
|
|
tooltipAnchor: [0, -22],
|
|
}
|
|
);
|
|
|
|
Icons.reuse = L.icon(
|
|
{
|
|
iconUrl: 'img/icons/reimpiego.png',
|
|
iconSize: [18, 27],
|
|
iconAnchor: [10, 24],
|
|
tooltipAnchor: [0, -22],
|
|
}
|
|
);
|
|
|
|
Icons.camera = L.divIcon({className: 'fa fa-camera'});
|
|
|
|
/**
|
|
* Assigns a different color to the icon
|
|
* based on building tech type
|
|
* @param {string} techType The type (name) of the building tech
|
|
*/
|
|
Icons.techIcon = (techType) => {
|
|
const colorClass = buildingTechColors[techType] ?? "has-text-link-45";
|
|
return L.divIcon({className: `fa fa-circle ${colorClass}`});
|
|
}
|
|
|
|
export default Icons; |