开发者

Google Maps API 3 - Check if marker is in view

I see 开发者_如何学Gothat there is a getVisible call, but that only checks if the marker is on the map NOT if the marker is in the current view.

I want to check if the marker is in the current view bounds?


I guess you want

map.getBounds().contains(marker.getPosition())


You need to tell map that your markers should be contained within view by adding following code

google.maps.event.addListener(map, 'bounds_changed', function() {
    map.getBounds().contains(marker.getPosition()) 
});

Here bound_changed event is triggered.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜