From 686d8323826bb3fd72cbba08e52fa383e3f404ca Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 29 Dec 2013 20:01:53 +0000 Subject: removing overlay (newmarker) when new one gets set) --- map3.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/map3.js b/map3.js index ebc3f21..33b1d95 100644 --- a/map3.js +++ b/map3.js @@ -4,7 +4,7 @@ var geocoder = null; var reloadcon = null; var countboxText = null; var overlays = new Array(); -overlays["new"] = null; +overlays["newmarker"] = null; overlays["ruler"] = new Array(); overlays["locations"] = new Array(); overlays["links"] = new Array(); @@ -74,13 +74,6 @@ function onAddOverlay(overlay) { switch(overlay.overlaytype) { case "location": overlays["locations"].push(overlay); break; case "link": overlays["links"].push(overlay); break; - case "new": { - if(overlays["newmarker"]) { - map.removeOverlay(overlays["newmarker"]); - } - overlays["newmarker"] = overlay; - break; - } case "ruler": { if(overlays["ruler"][overlay.overlaysubtype]) { map.removeOverlay(overlays["ruler"][overlay.overlaysubtype]); @@ -539,13 +532,16 @@ function addNewNodeText(point) { } function setNewMarker(point) { -// TODO: if a new new marker is set: remove the old one // TODO: make this dragable?? var marker = new google.maps.Marker({position: point, icon: makeIcon('newnode')}); var infowindow = new google.maps.InfoWindow({ content: addNewNodeText(point) }); google.maps.event.addListener(infowindow,"closeclick",function () { marker.setMap(null); }); marker.setMap(map); infowindow.open(map,marker); + if(overlays["newmarker"]) { + overlays["newmarker"].setMap(null); + } + overlays['newmarker'] = marker; } function fflogin(username, password) { -- cgit v1.2.1