1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

fixing leaflet icon path

This commit is contained in:
Patrik J. Braun 2021-05-01 19:35:18 +02:00
parent 27eed745cf
commit 4b81189c87
2 changed files with 20 additions and 2 deletions

View File

@ -63,7 +63,7 @@
{
"glob": "**/*",
"input": "node_modules/leaflet/dist/images/",
"output": "./"
"output": "./assets/"
}
],
"styles": [
@ -155,7 +155,7 @@
{
"glob": "**/*",
"input": "node_modules/leaflet/dist/images/",
"output": "./"
"output": "./assets/"
}
]
}

View File

@ -99,6 +99,7 @@ import {GallerySearchFieldComponent} from './ui/gallery/search/search-field/sear
import {AppRoutingModule} from './app.routing';
import {CookieService} from 'ngx-cookie-service';
import {LeafletMarkerClusterModule} from '@asymmetrik/ngx-leaflet-markercluster';
import {icon, Marker} from 'leaflet';
@Injectable()
@ -127,6 +128,23 @@ export class CustomUrlSerializer implements UrlSerializer {
}
}
// Fixes Leaflet icon path issue:
// https://stackoverflow.com/questions/41144319/leaflet-marker-not-found-production-env
const iconRetinaUrl = 'assets/marker-icon-2x.png';
const iconUrl = 'assets/marker-icon.png';
const shadowUrl = 'assets/marker-shadow.png';
const iconDefault = icon({
iconRetinaUrl,
iconUrl,
shadowUrl,
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
tooltipAnchor: [16, -28],
shadowSize: [41, 41]
});
Marker.prototype.options.icon = iconDefault;
@NgModule({
imports: [