fix: error on loading logo on maps
This commit is contained in:
parent
661fcdb16b
commit
eb9badb4a1
@ -38,18 +38,22 @@ async function getData() {
|
|||||||
|
|
||||||
let icon = null;
|
let icon = null;
|
||||||
if (d.uuid !== null) {
|
if (d.uuid !== null) {
|
||||||
const img = await getMeta(`${api_url}/api/club/${d.uuid}/logo`);
|
try {
|
||||||
let ratio = img.naturalHeight / img.naturalWidth;
|
const img = await getMeta(`${api_url}/api/club/${d.uuid}/logo`);
|
||||||
|
let ratio = img.naturalHeight / img.naturalWidth;
|
||||||
|
|
||||||
icon = L.icon({
|
icon = L.icon({
|
||||||
iconUrl: `${api_url}/api/club/${d.uuid}/logo`,
|
iconUrl: `${api_url}/api/club/${d.uuid}/logo`,
|
||||||
|
|
||||||
iconSize: [50, 50 * ratio], // size of the icon
|
iconSize: [50, 50 * ratio], // size of the icon
|
||||||
//shadowSize: [50, 64], // size of the shadow
|
//shadowSize: [50, 64], // size of the shadow
|
||||||
iconAnchor: [25, 50 * ratio], // point of the icon which will correspond to marker's location
|
iconAnchor: [25, 50 * ratio], // point of the icon which will correspond to marker's location
|
||||||
//shadowAnchor: [4, 62], // the same for the shadow
|
//shadowAnchor: [4, 62], // the same for the shadow
|
||||||
popupAnchor: [0, -50 * ratio] // point from which the popup should open relative to the iconAnchor
|
popupAnchor: [0, -50 * ratio] // point from which the popup should open relative to the iconAnchor
|
||||||
});
|
});
|
||||||
|
}catch (e) {
|
||||||
|
console.log("Error loading image for club", d.name, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const m of d.training_location) {
|
for (const m of d.training_location) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user