如何从 MapController 捕获放大/缩小动画的结尾?
这里只是一个有趣的查询,有没有一种方法可以在调用时捕获缩放动画序列何时结束:
MapController.zoomIn() or MapController.zoomOut();
我知道它确实会启动动画序列以放大/缩小到下一个级别,但是我没有已知的方法可以查找/谷歌搜索等来找出它何时完成该序列。我需要能够在停止时运行更新命令,以便我的地图正确更新。
我发现通过在调用上述函数后运行更新命令,投影不是来自缩小级别,而是介于两者之间(因此我无法显示我需要的所有数据)。
Just an interesting query here, is there a way to capture when a zoom animation sequence has ended when calling either:
MapController.zoomIn() or MapController.zoomOut();
I know that it does kick off an animation sequence to zoom in/out to the next level, however there is no known way I can find/google search, etc to find out when it finishes that sequence. I need to be able to run an update command when that is stopped so my map updates correctly.
I've found that by running the update command after calling the above function the Projection isn't from the zoom out level but somewhere inbetween (so I can't show all the data I need).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不得不承认我在这里下注了,这是一个黑客,但效果很好。我一开始需要知道缩放何时发生,一旦我陷入其中(经过一些有趣的调试),我发现一些值是“缩放之间”值,所以我需要等到缩放完成后。
正如 Stack Overflow 上其他地方所建议的,我的缩放侦听器是一个重写的 MapView.dispatchDraw,它检查缩放级别自上次以来是否已更改。
除此之外,我添加了一个 isResizing 方法,用于检查自 getLongitudeSpan 值停止更改以来时间戳是否超过 100 毫秒。效果很好。这是代码:
我的第一篇 Stack Overflow 帖子!呼呼!
公共类 MapViewWithZoomListener 扩展 MapView {
I have to admit I punted here, it's a hack but it works great. I started off with a need to know when a zoom occured, and once I hooked into that (and after some interesting debugging) I found some values were "between zoom" values, so I needed to wait till after the zoom was done.
As suggested elsewhere on Stack Overflow my zoom listener is an overridden MapView.dispatchDraw that checks to see if the zoom level has changed since last time.
Beyond that I added an isResizing method that checks if the timestamp is more than 100ms since the getLongitudeSpan value stopped changing. Works great. Here is the code:
My very first Stack Overflow post! Whoo Hoo!
public class MapViewWithZoomListener extends MapView {