control – OpenLayers: How to disable the shift key or freehand mode for DrawFeature – Stack Overflow

I would like to disable the shift key or freehand mode for the DrawFeature Control. A typical code looks like that: There is the option to switch freehand on. But there is nothing to totally deactivate it. Every time I hit shift the freehand mode is used. See http://dev.openlayers.org/docs/files/OpenLayers/Handler/Path-js.html#OpenLayers.Handler.Path.freehandToggle drawFeatureControl.handler.freehandToggle = null, does the trick. Reset it to 'shiftKey' if you want to re-enable it. var drawOptions = {handlerOptions: {freehand: true}}, drawFeatureControl = new OpenLayers.Control.DrawFeature(lineLayer, OpenLayers.Handler.Path, drawOptions), map.addControl(drawFeatureControl), There is the option to switch freehand on. But there is nothing to totally deactivate it. Every time I hit shift the freehand mode is used. Perfect! It works. But now the square from the OpenLayers.Control.Navigation() shows up while shift is pressed ,) Do you know the trick for this aswell? Confirmed, 'map.getControlsByClass('OpenLayers.Control.Navigation')[0].zoomBox.deactivate()‌​‌​' disables the 'Shift-Zoom-Box-feature' in OpenLayers 2.13.1 Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 24, 2016 @ 12:08 am