[OpenLayers-Dev] OpenLayers.Control.DrawFeature stops click event
propagation
ydumais
ydumais at korem.com
Tue Feb 9 10:06:22 EST 2010
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 rather clunky.
Any help appreciated.
--
View this message in context: http://n2.nabble.com/OpenLayers-Control-DrawFeature-stops-click-event-propagation-tp4541533p4541533.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.
More information about the Dev
mailing list