diff options
author | Christian Pointner <equinox@ffgraz.net> | 2013-12-29 20:01:53 +0000 |
---|---|---|
committer | Christian Pointner <equinox@ffgraz.net> | 2013-12-29 20:01:53 +0000 |
commit | 686d8323826bb3fd72cbba08e52fa383e3f404ca (patch) | |
tree | 57f601dee6ecb8f2355c7e52e5866b5ad470b062 /map3.js | |
parent | 95033078a4d4a10c01f63e07ecbe0953e81de8ba (diff) |
removing overlay (newmarker) when new one gets set)
Diffstat (limited to 'map3.js')
-rw-r--r-- | map3.js | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -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) { |