Don't set map at each click

This commit is contained in:
Frederic Junod
2012-10-02 11:25:58 +02:00
parent 671c902d72
commit 8a5e7c77c9

View File

@@ -35,6 +35,7 @@ var vienna = new ol.overlay.Overlay({
// Popup showing the position the user clicked
var popup = new ol.overlay.Overlay({
map: map,
element: document.getElementById('popup')
});
map.addEventListener('click', function(evt) {
@@ -43,6 +44,5 @@ map.addEventListener('click', function(evt) {
'Welcome to ol3. The location you clicked was<br>' +
ol.CoordinateFormat.hdms(ol.Projection.transformWithCodes(
coordinate, 'EPSG:3857', 'EPSG:4326'));
popup.setMap(evt.map);
popup.setCoordinate(evt.getCoordinate());
});