Fix performance, add 'isClosed' badge to shops

This commit is contained in:
Pieter Vander Vennet 2020-12-06 00:20:27 +01:00
parent efd7631837
commit a9dfce72a6
18 changed files with 334 additions and 124 deletions

View file

@ -152,8 +152,16 @@ export class FilteredLayer {
color: style.color
});
} else {
style.icon.html.ListenTo(self.isDisplayed)
marker = L.marker(latLng, {
icon: L.divIcon(style.icon)
icon: L.divIcon({
html: style.icon.html.Render(),
className: style.icon.className,
iconAnchor: style.icon.iconAnchor,
iconUrl: style.icon.iconUrl,
popupAnchor: style.icon.popupAnchor,
iconSize: style.icon.iconSize
})
});
}
return marker;

View file

@ -67,11 +67,15 @@ export default class MetaTagging {
let centerPoint: any = GeoOperations.centerpoint(feature);
const lat = centerPoint.geometry.coordinates[1];
const lon = centerPoint.geometry.coordinates[0]
const lon = centerPoint.geometry.coordinates[0];
coder.GetCountryCodeFor(lon, lat, (countries) => {
feature.properties["_country"] = countries[0].trim().toLowerCase();
const tagsSource = State.state.allElements.getEventSourceFor(feature);
tagsSource.ping();
try {
feature.properties["_country"] = countries[0].trim().toLowerCase();
const tagsSource = State.state.allElements.getEventSourceFor(feature);
tagsSource.ping();
} catch (e) {
console.error(e)
}
});
}
)
@ -85,6 +89,8 @@ export default class MetaTagging {
if (tags.opening_hours === undefined || tags._country === undefined) {
return;
}
try{
const oh = new opening_hours(tags["opening_hours"], {
lat: tags._lat,
lon: tags._lon,
@ -105,7 +111,7 @@ export default class MetaTagging {
tagsSource.ping();
}
const nextChange = oh.getNextChange() as Date;
const nextChange = oh.getNextChange();
if (nextChange !== undefined) {
window.setTimeout(
updateTags,
@ -114,6 +120,10 @@ export default class MetaTagging {
}
}
updateTags();
}catch(e){
console.error(e);
tags["_isOpen"] = "parse_error";
}
})
})