谷歌地图拖尾事件 v3

发布于 2025-01-06 13:47:24 字数 289 浏览 3 评论 0原文

目前我的谷歌地图上有这个侦听器事件:

google.maps.event.addListener(map, 'dragend', function() { checkBounds(); });

但是我发现然后我“抛出”地图(即在iPhone上拍摄并单击地图向上滚动),拖尾发生在地图完成移动之前;给了我一个错误的边界。有没有一种方法可以优雅地知道边界何时停止移动?我知道我可以继续一遍又一遍地使用bounds_changed进行检查;但想知道是否有更干净的方法来做到这一点。

干杯

Currently I have this listener event on my google maps:

google.maps.event.addListener(map, 'dragend', function() { checkBounds(); });

However I find that then I "throw" the map (ie on an iPhone taking and clicking the map up to scroll) the dragend happens before the map is done moving; giving me a false boundary. Is there a way to know when the bounds have stopped moving that is graceful? I know i can continue to check using the bounds_changed over and over; however was wondering if there was a cleaner way of doing this.

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

背叛残局 2025-01-13 13:47:24

请尝试使用空闲侦听器,尽管它也会在缩放后触发。

Try the idle listener instead, although that will also fire after a zoom.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文