I would like to disable the shift key or freehand mode for the DrawFeature Control. A typical code looks like that:
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.
In my use case I would like to use the shift key for another behaviour.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With