开发者

why "event is undefined" when rightclick on google-map-v3

this is my code:

开发者_运维技巧
google.maps.event.addListener(marker, 'rightclick', function(event) {

    //delete marker
    var nowIndex1='nowIndex1';
    function callback1(element, index){
        if(marker == element) nowIndex1=index
    }
    markers.forEach(callback1)
    if(nowIndex1!='nowIndex1') markers.removeAt(nowIndex1)

    //delete path
    var nowIndex2='nowIndex2';
    function callback2(element, index){
        if(event.latLng == element) nowIndex2=index
    }
    path.forEach(callback2)
    if(nowIndex1!='nowIndex1') path.removeAt(nowIndex2)

    marker.setMap(null)

})

and the error is "event is undefined"

so what should i do .

thanks


This one is bad. It is supposed to return the DOM's mousedown event. I believe it is a bug. I also tried to access the event, because I wanted to place a menu next to the pointer, so I had to use the framework to give me the location of the pointer to accomplish putting the menu next to the marker.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜