Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone explain how I can ovveride the dblclick event when I'm using an OpenLayers.Control.DrawFeature? I see there is parameter in the constructor for handlerOptions - Used to set non-default properties on the control’s handler. My handler is just an OpenLayers.Handler.Path.

I want to run some custom validation when a user double clicks so that they can continue the sketch should they fail.

Double click --> "you've drawn something stupid are you sure you want to finish?" --> No ---> carry on sketching

Thanks, James

share|improve this question

if you make some edit here OpenLayers / lib / OpenLayers / Handler / Path.js , you can reach what you want.


* APIMethod: finishGeometry
* Finish the geometry and send it back to the control.
    finishGeometry: function() {
        var index = this.line.geometry.components.length - 1;

* Method: dblclick
* Handle double-clicks.
* Parameters:
* evt - {Event} The browser event
* Returns:
* {Boolean} Allow event propagation
    dblclick: function(evt) {
        if(!this.freehandMode(evt)) {
        return false;

i hope it helps you...

share|improve this answer
Thanks Aragon - i've chucked my logic in there for now – geo_james May 31 '12 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.