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
if (Config.Client.Map.useImageMarkers === true) {
const iconTh = this.thumbnailService.getIcon(new MediaIcon(p));
this.thumbnailsOnLoad.push(iconTh);
iconTh.Visible = true;
const setIcon = () => {
mkr.setIcon(icon({
iconUrl: iconTh.Src,
iconSize: this.usedIconSize, // size of the icon
}));
mkr.options.alt = p.name;
};
mkr.on('add', () => {
const iconTh = this.thumbnailService.getIcon(new MediaIcon(p));
this.thumbnailsOnLoad.push(iconTh);
iconTh.Visible = true;
const setIcon = () => {
mkr.setIcon(icon({
iconUrl: iconTh.Src,
iconSize: this.usedIconSize, // size of the icon
}));
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) {