added a single config option to allow several features as a result of a click (or 'zero extent' box), r=elemoine, (Closes #2643)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10361 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -65,6 +65,16 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* selected. Default is true.
|
||||
*/
|
||||
click: true,
|
||||
|
||||
/**
|
||||
* APIProperty: single
|
||||
* {Boolean} Tells whether select by click should select a single
|
||||
* feature. If set to false, all matching features are selected.
|
||||
* If set to true, only the best matching feature is selected.
|
||||
* This option has an effect only of the <click> option is set
|
||||
* to true. Default is true.
|
||||
*/
|
||||
single: true,
|
||||
|
||||
/**
|
||||
* APIProperty: clickout
|
||||
@@ -98,7 +108,11 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* APIProperty: box
|
||||
* {Boolean} Allow feature selection by drawing a box.
|
||||
* {Boolean} Allow feature selection by drawing a box. If set to
|
||||
* true set <click> to false to disable the click handler and
|
||||
* rely on the box handler only, even for "zero extent" boxes.
|
||||
* See the description of the <click> option for additional
|
||||
* information. Default is false.
|
||||
*/
|
||||
box: false,
|
||||
|
||||
@@ -211,7 +225,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
if(this.click) {
|
||||
this.handlers.click = new OpenLayers.Handler.Click(this,
|
||||
{click: this.selectSingle}, this.handlerOptions.click || {});
|
||||
{click: this.selectClick}, this.handlerOptions.click || {});
|
||||
}
|
||||
|
||||
if(this.box) {
|
||||
@@ -270,20 +284,20 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: selectSingle
|
||||
* Method: selectClick
|
||||
* Called on click
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {<OpenLayers.Event>}
|
||||
*/
|
||||
selectSingle: function(evt) {
|
||||
selectClick: function(evt) {
|
||||
// Set the cursor to "wait" to tell the user we're working on their click.
|
||||
OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait");
|
||||
|
||||
var bounds = this.pixelToBounds(evt.xy);
|
||||
|
||||
this.setModifiers(evt);
|
||||
this.request(bounds, {single: true});
|
||||
this.request(bounds, {single: this.single});
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user