Im trying to do some event-listeners for my homepage. But I can only register one event. The event that works for me is adding Marker's and a circle to it. But when im trying to do something else like rigthclicking on the marker to delete it or get the radius off the circle when the radius is changed. Anyone know what im doing wrong? I also have problems with the showning the map. The map gets loaded and i can see everything except the map.
var map = new google.maps.Map(document.getElementById("map_areas"), {
zoom:8,
center: latlng,
mapTypeId:google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
zoomControl: true,
zoomControlOptions: { style: google.maps.ZoomControlStyle.LARGE},
overviewMapControl: true,
panControl: true
});
var marker;
var circle;
google.maps.event.addListener(map, 'click', function(evt) {
addMarkerAndCircle(evt);
});
function addMarkerAndCircle(evt) {
marker = new google.maps.Marker({
position: evt.latLng,
animations: google.maps.Animation.DROP,
map:map,
draggable: true,
clickable:true
});
circle = new google.maps.Circle({
map:map,
radius:16093, // 10 miles in metres
fillColor:'#AA0000',
clickable: true,
editable: true
});
circle.bindTo('center', marker, 'position');
markersArray.push(marker);
circleArray.push(circle);
}
google.maps.event.addListener(circle, 'radius_changed', function() {
var radius = circle.getRadius();
});