Search code examples
gwtpropertiesnavigationopenlayers

change navigation properties gwt openlayers


In my gwt application I make use of gwt-openlayers library. To disable the navigation control one can do something like:

Control control = getMap().getControlsByClass("OpenLayers.Control.Navigation");
control.deactivate();

This will prevent zoom, double click, drag, etc. Is there any way I can prevent just the zoom (mouse wheel and double click)?


Solution

  • The zoom on mouse wheel is a property that can be changed like:

    NavigationOptions navOptions = new NavigationOptions();
    navOptions.setZoomWheelEnabled(false);
    

    But I did not find a way to prevent the zoom on double click.

    I end up preventing the zoom by calling:

    map.setMinMaxZoomLevel(minZoomLevel, maxZoomLevel)
    

    and apply the same value for both minZoomLevel and maxZoomLevel.