Fix error in view-padding example

An error occured when the buttons are clicked before the source is loaded.
This commit is contained in:
Maximilian Krög
2021-05-08 02:15:43 +02:00
parent c19ebc72cb
commit dabfe40700

View File

@@ -50,6 +50,7 @@ const map = new Map({
view: view,
});
vectorLayer.getSource().on('featuresloadend', function () {
const zoomtoswitzerland = document.getElementById('zoomtoswitzerland');
zoomtoswitzerland.addEventListener(
'click',
@@ -71,3 +72,4 @@ centerlausanne.addEventListener(
},
false
);
});