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

improving map: only loading map icon if visible

This commit is contained in:
Patrik J. Braun 2021-05-04 22:10:24 +02:00
parent c5a1fa2657
commit 73d820d900

View File

@ -254,22 +254,24 @@ export class GalleryMapLightboxComponent implements OnChanges {
// Setting photo icon // Setting photo icon
if (Config.Client.Map.useImageMarkers === true) { if (Config.Client.Map.useImageMarkers === true) {
const iconTh = this.thumbnailService.getIcon(new MediaIcon(p)); mkr.on('add', () => {
this.thumbnailsOnLoad.push(iconTh); const iconTh = this.thumbnailService.getIcon(new MediaIcon(p));
iconTh.Visible = true; this.thumbnailsOnLoad.push(iconTh);
const setIcon = () => { iconTh.Visible = true;
mkr.setIcon(icon({ const setIcon = () => {
iconUrl: iconTh.Src, mkr.setIcon(icon({
iconSize: this.usedIconSize, // size of the icon iconUrl: iconTh.Src,
})); iconSize: this.usedIconSize, // size of the icon
mkr.options.alt = p.name; }));
}; mkr.options.alt = p.name;
};
if (iconTh.Available === true) {
setIcon();
} else {
iconTh.OnLoad = setIcon;
}
});
if (iconTh.Available === true) {
setIcon();
} else {
iconTh.OnLoad = setIcon;
}
} }
}); });
if (this.gpxFiles) { if (this.gpxFiles) {