select features on "click" as opposed to on "mousedown" (closes #891)

thanks to all for the review and to crschmidt for updating the patch


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4241 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2007-09-12 14:25:34 +00:00
parent 446759fd65
commit 6f16455b1c
3 changed files with 161 additions and 6 deletions

View File

@@ -8,8 +8,8 @@
*
* Class: OpenLayers.Handler.Feature
* Handler to respond to mouse events related to a drawn feature.
* Callbacks will be called for over, move, out, up, and down (corresponding
* to the equivalent mouse events).
* Callbacks will be called for over, move, out, up, down, and click
* (corresponding to the equivalent mouse events).
*/
OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
@@ -41,6 +41,18 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
this.layer = layer;
},
/**
* Method: click
* Handle click. Call the "click" callback if down on a feature.
*
* Parameters:
* evt - {Event}
*/
click: function(evt) {
var selected = this.select('click', evt);
return !selected; // stop event propagation if selected
},
/**
* Method: mousedown
* Handle mouse down. Call the "down" callback if down on a feature.