Fix geolocation-orientation example migrating map postcompose event

This commit is contained in:
Florent gravin
2018-11-16 10:30:57 +01:00
committed by Tim Schaub
parent 039af41af1
commit eafe1bf8a3

View File

@@ -13,13 +13,13 @@ const view = new View({
zoom: 19 zoom: 19
}); });
const tileLayer = new TileLayer({
source: new OSM()
});
// creating the map // creating the map
const map = new Map({ const map = new Map({
layers: [ layers: [tileLayer],
new TileLayer({
source: new OSM()
})
],
target: 'map', target: 'map',
view: view view: view
}); });
@@ -155,7 +155,7 @@ const geolocateBtn = document.getElementById('geolocate');
geolocateBtn.addEventListener('click', function() { geolocateBtn.addEventListener('click', function() {
geolocation.setTracking(true); // Start position tracking geolocation.setTracking(true); // Start position tracking
map.on('postcompose', updateView); tileLayer.on('postrender', updateView);
map.render(); map.render();
disableButtons(); disableButtons();
@@ -197,7 +197,7 @@ simulateBtn.addEventListener('click', function() {
} }
geolocate(); geolocate();
map.on('postcompose', updateView); tileLayer.on('postrender', updateView);
map.render(); map.render();
disableButtons(); disableButtons();