[OpenLayers-Users] 2.7 EditingToolbar.js and Naviagtion.js Error

David Martin David at itbeyond.com.au
Thu Oct 2 23:28:43 EDT 2008


Hi,

 

I have spent some time looking into this and have found a problem. I am
a little confused about the best solution but here is the bug report:

When you have add a navigation control and disable the mouse wheel using
this (the rightclick handler makes no difference to the problem):

map.addControl(new OpenLayers.Control.Navigation({ 'zoomWheelEnabled':
false, 'handleRightClicks': true }));

 

Then you load an EditingToolbar using:

map.addControl(new OpenLayers.Control.EditingToolbar(vectors));

 

The zoomWheel becomes enables again on the map. I did some experiements
and did not load the EditingToolbar (the wheel was disabled as expected)
and added a button on a test page to enable the EditingToolbar and as
soon as it is enabled to the zoomWheel becomes active on the map.

 

I looked into the EditingToolbar.js file and found this section which I
think is causing the problem:

 

    initialize: function(layer, options) {

        OpenLayers.Control.Panel.prototype.initialize.apply(this,
[options]);

               

        this.addControls(

          [ new OpenLayers.Control.Navigation() ]

        );  

        var controls = [

          new OpenLayers.Control.DrawFeature(layer,
OpenLayers.Handler.Point, {'displayClass':
'olControlDrawFeaturePoint'}),

          new OpenLayers.Control.DrawFeature(layer,
OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'}),

          new OpenLayers.Control.DrawFeature(layer,
OpenLayers.Handler.Polygon, {'displayClass':
'olControlDrawFeaturePolygon'})

        ];

        for (var i=0, len=controls.length; i<len; i++) {

            controls[i].featureAdded = function(feature) { feature.state
= OpenLayers.State.INSERT; };

        }

        this.addControls(controls);

    },

 

It appears we are basically reloading the Navigation control using
default settings and thus enabling the zoomWheel.  Interesting enough
the rightClick zoom out function still works so this has not been
overridden. I am unsure how to proceed with this bug and was thinking
that the best solution is to look into the controls array to see if
Navigation is already loaded and not load it again, however I wonder if
the EditingToolbar.js should even be loading the Navigation control.

 

PS: It does not seem to matter which order you load the controls as the
nor does it matter if you turn off the vectors overlay the zoomWheel
just continues to work. 

Regards
David Martin
Managing Director
I.T. Beyond Pty Ltd

Postal:

PO BOX 967
HILLARYS WA 6923

Ph:

(08) 9403 3737 

Mobile:

0417 677 275 

Fax:

(08) 9403 3738

Skype:

itbeyond_david

________________________________

Check out our websites: www.ExplorOz.com <http://www.exploroz.com/>  and
www.itbeyond.com.au <http://www.itbeyond.com.au/> 

________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081003/fc35b25e/attachment.html


More information about the Users mailing list