开发者

Google maps: Can't click marker which is on top of another

I have a map with about hundred location points (markers). Which are开发者_JAVA技巧 grouped with ClusterMarker http://googlemapsapi.martinpearman.co.uk/clustermarker And then there's one "main" marker, which is draggable. If main marker location is overlapping with other marker then it becomes undraggable. Or in another words: clicking takes action on marker which is behind the main marker. Weird, because I'm setting zIndexProcess when creating the main marker, which brings it to the front of others (by default it's not like that). So.. I don't know what's the problem and how to ask but I would try like this: How to get clickable area to the front if I have brought to the front main marker icon already? (at least it is visible on top of others)

P.S. I have GPolygon drawn on the base of main marker (radius, a circle) and this circle is drawn behind all markers. Don't know if this is relevant. Oh, and I can't bring this polygon to the front (seems like zIndexProcess does not work on this)


I had a similar situation and what you can do is pass the event through to another object. In my example here if the condition is met then I pass the event (by triggering it) on the map itself. You could do a similar check to see if the event point is inside a visible polygon (I won't put that code here as it should be relatively easily doable) and pass the click event onto the polygon.

Here is the code (lightly modified) that I use:

google.maps.event.addListener(this.intLineObj ,"click", function(latlng) {
    if (<condition>)
    {
        //pass the event down to the map
        google.maps.event.trigger(map, "click", latlng);
    } else {
        //do stuff
    }
});  

I hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜