Ticket #891 (closed feature: fixed)
The Feature Handler doesn't allow registering a "click" event callback
| Reported by: | elemoine | Owned by: | tschaub |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.5 Release |
| Component: | Handler.Feature | Version: | 2.4 |
| Keywords: | Cc: | ||
| State: |
Description
Is there a good reason not to handle click events in Handler/Feature.js?
In some context it can be useful to register a click callback as opposed to a mousedown event callback. For example, you have a "click on map" callback registered and you don't this callback to trigger when you click on a drawn feature. Using toaday's SelectFeature control (and Feature Handler), you won't be able to click on your features without triggering the "click on map" callback. To be able to do that, you want to register a "click on feature" callback as opposed to a "mousedown on feature" callback. More precisely you want to do that:
var ctl = new OpenLayers.Control.SelectFeature(vectorLayer, {
callbacks: {
down: null, click: myFeatureClickCallback
}
});
which doesn't work today, because there's no "click" callback in Handler/Feature.js.
Attached patch addresses this.

