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

Scenario 1:

Let's say I have something like this:

`app_obj.MapObj.map.events.register("click", app_obj.MapObj.map, self.pointToVideoSearch);`

and another Click Control

OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
        defaultHandlerOptions: {
            "single" : true,
            "double" : false,
            "pixelTolerance" : 0,
            "stopSingle" : true,
            "stopDouble" : false
        },
        initialize: function(options){
            this.handlerOptions = OpenLayers.Util.extend(
                {}, this.defaultHandlerOptions
                );
            OpenLayers.Control.prototype.initialize.apply(this, arguments);
            this.handler = new OpenLayers.Handler.Click(
                this, {
                    "click" : this.onClick,
                    "dblclick": this.onDblclick
                }, this.handlerOptions
            );
        },

        onClick: clickFunction,
        onDblclick: dblClickFunction
    });

When I click on the map, first and second control (it's activated) are fired up. Why the "clickStop" is not working and stoping other click events to be fired?

Scenario 2:

if I had event like in Scenario 1:

app_obj.MapObj.map.events.register("click", app_obj.MapObj.map, self.pointToVideoSearch);

and a DrawFeature control to draw let's say Polygon, then the first event is silenced (when I am drawing polygon), never fires up until you are not finished with drawing polygon

My question is, what is stoping first event to fire up? I need to find out that tehnic

Thanks

share|improve this question

Try with this:

controls = { 

    point:   new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.Point, {
        eventListeners: {"featureadded": newPolygonAdded}
    }),

    line:    new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.Path, {
        eventListeners: {"featureadded": newPolygonAdded}
    }),

    polygon: new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.Polygon, {
        eventListeners: {"featureadded": newPolygonAdded}
    }),

    regular: new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.RegularPolygon, {
        eventListeners: {"featureadded": newPolygonAdded },
        handlerOptions: {sides: 5}
    }),

    modify:  new OpenLayers.Control.ModifyFeature(vectors, {
        onModificationStart: startModify,
        onModification: doModify
    })
};

for (var key in controls)
{
    map.addControl(controls[key]);
}

And add the corresponding event functions.

share|improve this answer

Your Answer

 
discard

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.