[OpenLayers-Users] SelectFeature on click problem

Eric Lemoine eric.lemoine at camptocamp.com
Thu Aug 27 00:40:45 EDT 2009


On Thursday, August 27, 2009, Brad Spencer <brad at cubewerx.com.au> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
> List,
>
>
>
> I have been struggling with a SelectFeature on a vector
> layer. I create the layers quite OK but am having trouble getting my popup to work
> on a mouse click on feature.
>
>
>
> My code snippet….
>
>
>
> // pointFeature is the array of sorted point objects to be
> added as vector markers
>
>                 userMarkers.addFeatures(filteredPoints);
>
>                 map.addLayer(userMarkers);
>
>
>
> //Create a select feature control and add it to the map.
>
>                  selectControl = new
> OpenLayers.Control.SelectFeature(userMarkers,
>
>                                 {
>
>                                                 //hover:
> true
>
>                                                 onSelect:
> onFeatureSelect
>
>                                                 ,onUnselect:
> onFeatureUnselect
>
>                                 });
>
>
>
>                 map.addControl(selectControl);
>
>                 selectControl.activate();
>
>
>
> When I run this code it will NOT trigger the onFeatureSelect
> function but if I set hover: true it does launch the function.
>
>
>
> Can anyone see a problem with this - I am using 2.8


Hi. The only thing I can think of is some other control activated
after the select feature control. For example if the navigation
control is activated after the select feature control the former (its
drag handler actually) will prevent mousedown events from propagating
to the select control.


>
>
>
> Cheers, Brad
>
>
>
>
>
>
>
>
>
>
>
>
>

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list