From 8a5e7c77c9888d9a3af8a6ce5c4b40ac5bd1cc05 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 2 Oct 2012 11:25:58 +0200 Subject: [PATCH 1/2] Don't set map at each click --- examples/overlay-and-popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/overlay-and-popup.js b/examples/overlay-and-popup.js index 3d18837bd5..78e0362b23 100644 --- a/examples/overlay-and-popup.js +++ b/examples/overlay-and-popup.js @@ -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
' + ol.CoordinateFormat.hdms(ol.Projection.transformWithCodes( coordinate, 'EPSG:3857', 'EPSG:4326')); - popup.setMap(evt.map); popup.setCoordinate(evt.getCoordinate()); }); From 3df18d2df8e8640f465762c2b47863a9469715ae Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 2 Oct 2012 11:26:44 +0200 Subject: [PATCH 2/2] Use existing local coordinate var --- examples/overlay-and-popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/overlay-and-popup.js b/examples/overlay-and-popup.js index 78e0362b23..660ab2f38f 100644 --- a/examples/overlay-and-popup.js +++ b/examples/overlay-and-popup.js @@ -44,5 +44,5 @@ map.addEventListener('click', function(evt) { 'Welcome to ol3. The location you clicked was
' + ol.CoordinateFormat.hdms(ol.Projection.transformWithCodes( coordinate, 'EPSG:3857', 'EPSG:4326')); - popup.setCoordinate(evt.getCoordinate()); + popup.setCoordinate(coordinate); });