[OpenLayers-Users] DrawFeature stops event propagation

ydumais ydumais at korem.com
Wed Feb 10 10:11:54 EST 2010


[this is a repost. Originally posted in the dev forum and realised my error].

Hi, 
we are using a custom Control.DrawFeature like so: 

... 
    var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer"); 
    this.map.addLayers([this.baseLayer, polygonLayer]); 
    var selectControl = new OpenLayers.Control.DrawFeature(polygonLayer,
OpenLayers.Handler.Point, {handlerOptions: {}}); 
    this.map.addControl(selectControl); 
... 

and the following Control.Click: 

Navigator.Control = {}; 
Navigator.Control.Click = OpenLayers.Class(OpenLayers.Control, { 
    defaultHandlerOptions: {'single': true, 'double': false,
'pixelTolerance': 0, 'stopSingle': false, 'stopDouble': false}, 

    initialize: function(instance) { 
        this.instance = instance; 
        this.handlerOptions =
OpenLayers.Util.extend({},this.defaultHandlerOptions); 
        OpenLayers.Control.prototype.initialize.apply(this, arguments); 
        this.handler = new OpenLayers.Handler.Click(this, { 
            'click': this.trigger 
        }, this.handlerOptions); 
    }, 

    trigger: function(event) { 
        var me = this; 
        console.log(event.altKey); 
    } 
}); 

The issue is that the trigger is not fired when the Draw control is active
(works fine otherwise). Is there a way to send the trigger to the map? 

To put in context, we are creating a select control that forwards the drawn
polygon to our mapping server (serving a WMS layer in this case). The
selection is done server side... I believe we can't use the
Control.SelectFeature with multipleSelect option since our OL map layers is
not aware of the different features. 

If I can't forward the event to the map, I contemplate creating double
controls (one with a handler with keyMask.MOD_NONE and one with a handler
keyMask.MOD_ALT) but I find this hack clunky. 

Any help appreciated. 
-- 
View this message in context: http://n2.nabble.com/DrawFeature-stops-event-propagation-tp4548447p4548447.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list