Edd
Edd

Reputation: 181

Javascript Google Maps API draggable marker click through

Is it normal behaviour that when I create a non-draggable marker and click, events work as they should.

But when I set draggable: true, draggable works good. But when clicking the marker it also clicks through it and sets another maker under it.

Is there something I am missing?

Update:

// marker clicks
function makeDescriptionShower(map, marker, uuid) {
return function() {
    console.log("event makeDesccriptionShower");
    marker.info.open(map, marker);
    //ED
    resetForm();
    editPOI(uuid, marker);
    ....
    }
}

.....

google.maps.event.addListener(marker, 'click', makeDescriptionShower(map, marker, uuid));


//map clicks
google.maps.event.addListener(map, 'click', function(e) {
    console.log("map event");
    cleanArrays();
    updatingFlag(false);
    resetForm();
    document.getElementById("latitude").value = e.latLng.lat();
    document.getElementById("longitude").value = e.latLng.lng();
    placeMarker(e.latLng, map);
});

Upvotes: 0

Views: 106

Answers (1)

Edd
Edd

Reputation: 181

Because I continue someone else project. There was error inside makeDescriptionShower with other function that made this click trough marker behaviour. I fixed everything by putting crashing code line inside window.onload=function(){.

Upvotes: 1

Related Questions