OpenLayers: disable zooming on double-click

Ovesh picture Ovesh · Sep 19, 2010 · Viewed 7.8k times · Source

OpenLayers, by default, zooms in when a user double clicks a map.

What is the best way to disable this behavior?

Answer

Chau picture Chau · Sep 29, 2010

The zoom on double click feature is apparently a functionality in the OpenLayers.Control.Navigation control. See the OpenLayers Reference for more information.

A small and very tired example:

var Navigation = new OpenLayers.Control.Navigation({
    defaultDblClick: function(event) { return; }
});

I remember that the Navigation control is automatically added to the map if no controls are set during the initialization of the map. So you might have to add the Navigation control your self.

Hope it helps =)