Google地图事件bounds_changed在拖动时会多次触发 [英] Google Map event bounds_changed triggered multiple times when dragging
问题描述
我有一个带有标记的谷歌地图。我希望在地图移动/缩放时刷新标记...
I have a google map with markers. I want my markers to be refreshed when the map is moved/zoomed...
Google建议使用事件 bounds_changed
,但是当我移动地图时,该事件会针对移动地图的每个像素触发。我希望地图只在用户停止移动地图时刷新,也就是当他在拖动后释放鼠标按钮时。
Google recommend to use the event bounds_changed
for that, but when I move the map, the event is triggered for each pixel that I move the map. I want the map to be refreshed only when the user stopped moving the map, i.e. when he released the mouse button after dragging.
我该怎么做?
感谢
Thanks
推荐答案
事实证明这是一个报告错误: http://code.google.com/p/gmaps-api-问题/问题/详细信息?id = 1371 。
It turns out it was a reported bug: http://code.google.com/p/gmaps-api-issues/issues/detail?id=1371.
Google团队建议使用闲置事件。例如:
The Google team recommend to use the event "idle". For example :
google.maps.event.addListener(map, 'idle', function() {
});
这篇关于Google地图事件bounds_changed在拖动时会多次触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!