[OpenLayers-Users] Mousewheel Zooms by 2 level

Christopher Schmidt crschmidt at metacarta.com
Tue Nov 11 06:24:54 EST 2008


On Tue, Nov 11, 2008 at 02:44:02AM -0800, Bijoy wrote:
> 
> After further exploring, it seems that the double zoom issue on mouse scroll
> appears only after I add the NavToolBar [ZoomBox]. I looked into the
> NavToolBar.js file, and Navigation() control is been initialized here as
> well. I had already included the Navigation control while defining the map.
> When I delete Navigation control which I had defined, the zoom issue on
> mouse scroll is fixed. However, I have no control about enabling/disabling
> mousescroll event on NavToolBar, as it does not have any property like,
> zoomWheelEnabled.
> I think this is a bug with the OL code, and need to be resolved.

The NavToolbar control is a simple control, wrapping up only 15 lines of
code. It is intentionally simple, and I see no reason to change this. If
you want a NavToolbar which behaves differently, it is very simple to
create one: simply:

  var tb = OpenLayers.Class(OpenLayers.Control.NavToolbar, {
      initialize: function() { 
          OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
          this.addControls([
            new OpenLayers.Control.Navigation({'zoomWheelEnabled': false}),
            new OpenLayers.Control.ZoomBox()
          ])
      }
  );
  map.addControl(new tb());

I do not believe this is a bug with the OpenLayers code -- making the
code this simple to change was intentional, and to try to handle
anything else would be unneccesary. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list