0

我有一张地图,上面有几个标记。缩小时,这些标记似乎在彼此之上。I want a menu to popup up on a right click with all of the markers within a certain distance of the mosue when the right mouse button is selected. 问题是,当鼠标位于标记上方时,我无法获得鼠标位置。

如果我向标记添加“右键单击”侦听器

        google.maps.event.addListener( marker, "rightclick", function ( e )
        {
            alert( "Lat = " + e.latLng.lat() + ": Lng =" + e.latLng.lng() );
        } );

鼠标事件中的位置是 Marker 的位置,而不是鼠标的位置。

如果我向地图添加“右键单击”侦听器

        google.maps.event.addListener( map, "rightclick", function ( e )
        {
            alert( "Lat = " + e.latLng.lat() + ": Lng =" + e.latLng.lng() );
        } );

当鼠标位于标记上方时,不会触发事件。

当鼠标位于标记上方时,有什么方法可以获取鼠标位置?

谢谢,罗恩

4

1 回答 1

0

您必须将clickable标记的 -property 设置为false,然后单击标记时会触发地图的单击事件。

于 2013-11-01T22:14:24.783 回答