Open layers 3, map.on('moveend',..): Differentiate between user interaction and map.setCenter() calling

China☆狼群 提交于 2021-02-10 05:13:34

问题


I am implementing OL for a GIS application and want to add a 20 seconds timeout when the user scrolled the map, after which the GPS auto track function should resume.

For that I am utilizing the map.on('moveend', move_func(..)) listener. The problem is that it cannot differenciate whether the user scrolled or the position change came from map.setCenter(..). Although I could implement a state variable which is set to true every time map.setCenter() is called, this does not only seem un-elegant but also wrong in case the setCenter call and a user interaction would overlap.

So is there any better solution to this?

Regards

来源:https://stackoverflow.com/questions/36845572/open-layers-3-map-onmoveend-differentiate-between-user-interaction-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!