diff options
-rw-r--r-- | map3.js | 55 |
1 files changed, 14 insertions, 41 deletions
@@ -507,7 +507,8 @@ function showElements(elements) { } function centerAndZoom(lat, lng) { - map.setCenter(new google.maps.LatLng(lat, lng), 17); + map.setCenter(new google.maps.LatLng(lat, lng)); + map.setZoom(20); } function addNewNodeText(point) { @@ -518,8 +519,8 @@ function addNewNodeText(point) { var lat_startpoint = 47.07177327969; var dy_dlat = 75505.521; - var pixel_x = parseInt(Math.floor(x_startpoint + (point.lng - lng_startpoint) * dx_dlng)); - var pixel_y = parseInt(Math.floor(y_startpoint - (point.lat - lat_startpoint) * dy_dlat)); + var pixel_x = parseInt(Math.floor(x_startpoint + (point.lng() - lng_startpoint) * dx_dlng)); + var pixel_y = parseInt(Math.floor(y_startpoint - (point.lat() - lat_startpoint) * dy_dlat)); var link = 'https://manman.graz.funkfeuer.at/location/new?'; link += 'z_x=' + Math.floor(pixel_x % 100) + '&z_y=' + Math.floor(pixel_y % 100); @@ -527,10 +528,10 @@ function addNewNodeText(point) { var html = '<b>Neuen Knoten eintragen<br />Nutzen sie den Zoombereich aus!</b><br /><br />'; html += '<table width="100%">'; - html += '<tr><td>Breitengrad:</td><td> </td><td>' + convertCoords(point.lat) + '</td><td> </td>'; + html += '<tr><td>Breitengrad:</td><td> </td><td>' + convertCoords(point.lat()) + '</td><td> </td>'; html += '<td><form action="#" onsubmit="return false"><input type="button" value="hineinzoomen" '; - html += 'onclick="javascript:centerAndZoom(' + point.lat + ',' + point.lng + ')" /></form></td></tr>'; - html += '<tr><td>Längengrad:</b></td><td> </td><td>' + convertCoords(point.lat)+ '</td><td> </td>'; + html += 'onclick="javascript:centerAndZoom(' + point.lat() + ',' + point.lng() + ')" /></form></td></tr>'; + html += '<tr><td>Längengrad:</b></td><td> </td><td>' + convertCoords(point.lng())+ '</td><td> </td>'; html += '<td><form action="#" onsubmit="return false"><input type="button" value="Standort eintragen" '; html += 'onclick="window.open(\'' + link + '\')" /></form></td></tr>'; html += '</table>'; @@ -538,41 +539,13 @@ function addNewNodeText(point) { } function setNewMarker(point) { -/* - var marker = new GMarker(point,{icon: makeIcon('newnode'), draggable: true}); - google.maps.event.addListener(marker, "dragstart", - function() { - this.autoclosed = true; - this.closeInfoWindow(); - }); - - google.maps.event.addListener(marker, "dragend", - function(point) { - this.openInfoWindowHtml(addNewNodeText(point)); - }); - - google.maps.event.addListener(marker, "infowindowclose", - function () { - if(this.autoclosed == true) { - this.autoclosed = false; - } else { - map.removeOverlay(overlays["newmarker"]); - overlays["newmarker"] = null; - } - }); - - marker.overlaytype = "newmarker"; - map.addOverlay(marker); - marker.openInfoWindowHtml(addNewNodeText(point)); -*/ - - - var marker = new google.maps.Marker({position: point, icon: makeIcon('newnode')}); - // google.maps.event.addListener(marker,"infowindowclose",function () { - // map.removeOverlay(marker); - // }); - marker.setMap(map); - marker.openInfoWindowHtml(addNewNodeText(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); } function fflogin(username, password) { |