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