[OpenLayers-Users] mousewheel jumps two zoom levels

Andreas Hocevar ahocevar at opengeo.org
Thu Jan 26 10:51:50 EST 2012


Hi,

whether one tick on the mouse wheel is one zoom level or not depends
on the mouse sensitivity, which is a system-wide setting. You can,
however, pass something like

mouseWheelOptions: {interval: 20, cumulative: false}

to the Navigation control, and it will only change the zoom by 1 for a
20ms drag. You can try this setting online here:
http://openlayers.org/dev/examples/mobile-wmts-vienna.html

Andreas.

On Thu, Jan 26, 2012 at 4:41 PM, Daniel Behr <daniel.behr at hzg.de> wrote:
> I'm facing a similar problem, but for my app its a cross-browser issue on
> windows machines only! on linux its fine and the map has only one Navigation
> Control.
>
> does this help to spot the problem?
>
> Daniel
>
> Am 26.01.2012 16:25, schrieb Andreas Hocevar:
>
>> My guess is that you have two Navigation controls. One that is added
>> to the map by default unless you configure it with your custom array
>> of controls, and the navControl you added.
>>
>> You can check in the javascript console by trying
>>
>> map.getControlsByClass("OpenLayers.Control.Navigation");
>>
>> and see if it returns an array of length 1 or 2.
>>
>> The obvious fix is to configure the map with your own default set of
>> controls.
>>
>> Andreas.
>>
>> On Thu, Jan 26, 2012 at 3:29 PM, Vidal, Antoni<antoni.vidal at icc.cat>
>>  wrote:
>>>
>>> Hi list,
>>>
>>>
>>>
>>> I’ve an OpenLayers.control.Navigation with following config options:
>>>
>>>
>>>
>>>         var navControl = new OpenLayers.Control.Navigation({
>>>
>>>             type: OpenLayers.Control.TYPE_TOGGLE,
>>>
>>>             zoomWheelEnabled: true,
>>>
>>>             mouseWheelOptions: {interval: 1}
>>>
>>>         });
>>>
>>>
>>>
>>> But when user changes map zoom level using mousewheel, map zoomlevel
>>> jumps
>>> from 0 to 2 and then to 4, etc.
>>>
>>>
>>>
>>> Is possible to change this behaviour and force change zoomlevel one by
>>> one ?
>>>
>>>
>>>
>>> Thanks in advance.
>>>
>>>
>>>
>>> Antoni Vidal
>>>
>>> Unitat d'Aplicacions SIG-WEB
>>> Institut Cartogràfic de Catalunya
>>> Parc de Montjuïc, E-08038 Barcelona
>>> Tel. (+34) 93 567 15 00 (ext. 3228)
>>> www.icc.cat
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>
>>
>>
>>
>
> --
> Daniel Behr
> Institut für Küstenforschung
> WebGIS Entwicklung
> +49 (0)4152 87 1589 (fax -1596)
> Daniel.Behr at hzg.de
> Helmholtz-Zentrum Geesthacht Zentrum für Material- und Küstenforschung GmbH
> Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany
> Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing.
> Michael Ganß Vorsitzender des Aufsichtsrates/Chairman of the Supervisory
> Board: MinDirig Wilfried Kraus Amtsgericht Lübeck HRB 285 GE (Register
> Court) Internet: http://www.hzg.de
>  _______________________________________________
>
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list