shakirthow
shakirthow

Reputation: 1366

Zoom changed event for nokia Here maps

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!

Upvotes: 1

Views: 1192

Answers (1)

Jithin Krishnan
Jithin Krishnan

Reputation: 1044

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;
})

Upvotes: 5

Related Questions