my map is a interactive map for users with exotics palm. Normaly there
put a new single marker in place where the plant is growing. For that
job, the normaly map does it very well (
www.palmenstandorte.de).
But if I include the markerCluster (from Luke Mahe) the click-listener
only trigger on 'map-click' - not on 'cluster-click'
My first solution:
google.maps.event.addListener(map, "click", function(event) {
marker = new google.maps.Marker({
position: event.latLng,
map: map,
draggable: true
});
map.setCenter(event.latLng);
map.setZoom(13) ;
google.maps.event.addListener(marker, "click", function() {
infowindow.open(map, marker);
});
google.maps.event.addListener(markerClusterer,"clusterclick",function(cluster)
{
var center = cluster.getCenter();
var size = cluster.getSize();
var markers = cluster.getMarkers();
});
});
The result: only the job "set new marker" was done - even by a click
of a clustered marker.
My second solution:
google.maps.event.addListener(map, 'click', function (event) {
if (!clusterclicked) {
clusterclicked = true;
google.maps.event.addListener(markerClusterer,"clusterclick",function(cluster)
{
var center = cluster.getCenter();
var size = cluster.getSize();
var markers = cluster.getMarkers();
});
}
else {
clusterclicked = false;
marker = new google.maps.Marker({
position: event.latLng,
map: map,
draggable: true
});
map.setCenter(event.latLng);
map.setZoom(13) ;
google.maps.event.addListener(marker, "click", function() {
infowindow.open(map, marker);
});
}
});
The result: only the trigger "click of a clustered marker" was done -
but you can't set a new marker on the map (http://http://
www.palmenstandorte.de/de/cluster.php)
The second solution I have find it on the net, with a set_time_out-
function (
http://stackoverflow.com/questions/2881150/google-map-api-v3-
event-click-raise-when-clickingmarkerclusterer). Can anybody help me?