[OpenLayers-Users] SelectFeature on click problem

Brad Spencer brad at cubewerx.com.au
Thu Aug 27 03:28:30 EDT 2009


Eric,

This did it. I had the following DragFeature control immediately after the
SelectFeature control. 

controls = { drag: new OpenLayers.Control.DragFeature(userMarkers,
{'onComplete': onCompleteMove} )	}
	map.addControl(controls['drag']);
	controls['drag'].activate();

So I put this DragFeature control before it and it at least triggered off
the onFeatureSelect function. But I had to destroy and re-insert the
SelectFeature control at end of the onCompleteMove function that I trigger
in the DragFeature because it was then not working after a drag. Tricks for
the unwary.

But all seems to be OK now. Thanks.

Cheers, Brad... 

-----Original Message-----
From: Eric Lemoine [mailto:eric.lemoine at camptocamp.com] 
Sent: Thursday, August 27, 2009 2:41 PM
To: Brad Spencer
Cc: openlayers users
Subject: Re: [OpenLayers-Users] SelectFeature on click problem

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