Question

I'm using HERE JavaScript API and I'd like to disable zooming on map double click. Anybody know how to achieve it?

Was it helpful?

Solution 2

Take a look at the "Enabling and Disabling Double Click Zoom" example on the HERE Maps Community pages.

Assuming you already have a map with the standard nokia.maps.map.component.Behavior component, you will get a nokia.maps.map.DoubleClick component loaded by default.

To enable DoubleClick (if you haven't loaded behavior)

map.addComponent(new nokia.maps.map.component.zoom.DoubleClick());

To disable DoubleClick

 map.removeComponent(map.getComponentById("zoom.DoubleClick"));

OTHER TIPS

To accomplish the same thing in version 3 of the API

var map = new H.Map(...);
var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));

// responsible for disabling the double tap (click) to zoom
behavior.disable(H.mapevents.Behavior.DBLTAPZOOM);

stopPropagation() is what you are looking for:

map.addListener( "dblclick", function( evt ) {
   evt.stopPropagation();
   // stuff you want to do on double click on map
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top