Zoom changed event for nokia Here maps

和自甴很熟 提交于 2019-12-12 04:08:02

问题


I'm confused on how to handle zoom events with Nokia Here maps. Usually for example

map.addEventListener('dragend', function(){....})

why cant the same signature work for something like

map.addEventListener('zoomend', function(){....})

I know there is a event called mapviewchangeend but how will I use that to know if it was a zoom change rather a drag

Thanks!


回答1:


The supported map events are documented here , i think simplest way to achieve your requirement would be to check the map zoom level in the mapviewchangeend listener.

var oldZoom=map.getZoom();
map.addEventListener('mapviewchangeend', function(){
     var newZoom=map.getZoom();
     if(newZoom > oldZoom){
      // zoomed in
     }else{
      // zoomed out
     }
     oldZoom=newZoom;
})


来源:https://stackoverflow.com/questions/36142083/zoom-changed-event-for-nokia-here-maps

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