0

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

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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