I am implementing OpenLayers 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 differentiate 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 inelegant but also wrong in case the setCenter call and a user interaction would overlap.

So is there any better solution to this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.