Improve map display by showing site locations correctly
Fixes an issue where map markers were not displaying correctly on the mobile planning page by implementing a default blue icon for sites not on a patrol route. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e5565357-90e1-419f-b9a8-6ee8394636df Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/e5565357-90e1-419f-b9a8-6ee8394636df/WbUtQAg
This commit is contained in:
parent
6d2e92c76e
commit
ce6478e77e
@ -17,13 +17,19 @@ import { queryClient } from "@/lib/queryClient";
|
|||||||
|
|
||||||
// Fix Leaflet default icon issue with Webpack
|
// Fix Leaflet default icon issue with Webpack
|
||||||
delete (L.Icon.Default.prototype as any)._getIconUrl;
|
delete (L.Icon.Default.prototype as any)._getIconUrl;
|
||||||
L.Icon.Default.mergeOptions({
|
|
||||||
|
// Icona blu standard per siti non in route
|
||||||
|
const blueIcon = new L.Icon({
|
||||||
iconRetinaUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png',
|
iconRetinaUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png',
|
||||||
iconUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png',
|
iconUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png',
|
||||||
shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
|
shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
|
||||||
|
iconSize: [25, 41],
|
||||||
|
iconAnchor: [12, 41],
|
||||||
|
popupAnchor: [1, -34],
|
||||||
|
shadowSize: [41, 41]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Custom icon verde per marker selezionati nella patrol route
|
// Icona verde per marker selezionati nella patrol route
|
||||||
const greenIcon = new L.Icon({
|
const greenIcon = new L.Icon({
|
||||||
iconRetinaUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png',
|
iconRetinaUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png',
|
||||||
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-green.png',
|
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-green.png',
|
||||||
@ -471,7 +477,7 @@ export default function PlanningMobile() {
|
|||||||
<Marker
|
<Marker
|
||||||
key={site.id}
|
key={site.id}
|
||||||
position={[parseFloat(site.latitude!), parseFloat(site.longitude!)]}
|
position={[parseFloat(site.latitude!), parseFloat(site.longitude!)]}
|
||||||
icon={isInRoute ? greenIcon : undefined}
|
icon={isInRoute ? greenIcon : blueIcon}
|
||||||
eventHandlers={{
|
eventHandlers={{
|
||||||
click: () => handleAddToRoute(site),
|
click: () => handleAddToRoute(site),
|
||||||
}}
|
}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user