[OpenLayers-Dev] zoomwheel-only navigation

Christopher Schmidt crschmidt at metacarta.com
Tue Dec 16 08:45:22 EST 2008


On Tue, Dec 16, 2008 at 02:18:15PM +0100, bartvde at osgis.nl wrote:
> Hi Chris,
> 
> do stuff with no code at all are you serious :-) ?

Well, 'no' code is relative. 

What I would have done, instead of subclassing from ControlNavigation,
is:
 ZoomWheel=OL.Class(OL.Control, {
   wheelChange: OpenLayers.Control.Navigation.prototype.wheelChange,
   draw: function() {
    this.handler = new OpenLayers.Handler.MouseWheel( this,
      {'up': OpenLayers.Control.Navigation.prototype.wheelUp,
       'down': OpenLayers.Control.Navigation.prototype.wheelUp });
     this.activate();  
   }
 );   

I hadn't realized I'd need to copy the wheelChange method, but I *think*
that should do it.

But yes, 'not need any code' is a bit silly: obviously it needs *some*
code, even instantiating the existing control requires 1 line :) But I
don't consider either what you did or what I did to be a serious amount
of code in the long run. 18 lines of code is not a ridiculous amount --
and given the amount of code, documentation, etc. we'd have to write to
support all the combinations that people could want with various
controls, I'd much rather have little things like that live at the
application level. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list