问题
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