fix: deal with undefined

This commit is contained in:
moanos [he/him] 2025-01-02 11:14:34 +01:00
parent 6e2a2a1d5e
commit 8e7cdafee0

View File

@ -20,11 +20,17 @@
var center = [10.49, 50.68];
{% endif %}
{% if zoom_level %}
var zoom_level = {{ zoom_level }};
{% else %}
var zoom_level = 4;
{% endif %}
let map = new maplibregl.Map({
container: 'map',
style: '{% static "fellchensammlung/map/styles/colorful.json" %}',
center: center,
zoom: {{ zoom_level }}
zoom: zoom_level
}).addControl(new maplibregl.NavigationControl());
{% for adoption_notice in adoption_notices_map %}
@ -46,6 +52,7 @@
{% endif %}
{% endfor %}
{% if search_radius %}
map.on('load', () => {
const radius = {{ search_radius }}; // kilometer
const options = {
@ -82,5 +89,6 @@
}
});
});
{% endif %}
</script>