[OpenLayers-Users] Control.SelectFeature issue on FF (but not on Chrome)

Andreas Hocevar ahocevar at opengeo.org
Mon May 24 06:32:59 EDT 2010


Hi,

On May 24, 2010, at 12:17 , Alessandro Pasotti wrote:

> In data lunedì 24 maggio 2010 11:01:58, Andreas Hocevar ha scritto:
> : > Oh, and I was the reviewer. Great!
>> 
>> Well in that case, the solution to the OP's problem is to reconfigure the
>> control with the new set of layers after adding/removing layers, instead
>> of creating a new control with a new layer.
>> 
>> Regards,
>> Andreas.
> 
> Thank you all for the suggestions,
> 
> The suggested workaround works on both FF and Chrome, but I'm still confused: 
> what if I need two different controls instances attached to the the two layers 
> ?
> 
> Suppose I want the Control.SelectFeature attached to the first layer to open a 
> popup and the Control.SelectFeature attached to the second layer to update a 
> div somewhere in the page.

You can check for the layer that a feature was selected on in the event handler and perform different actions based on that. Why would you need a second control for that?

> Does Control.SelectFeature really needs to be a singleton ?

No, you can have as many SelectFeature controls as you want. But the way it works is that it needs to put the layers to select from at the top of the layer stack, and this is why you should just have one SelectFeature contorl *activated* at a time.

> Additionaly: why on Chrome I can have two different controls attached to my two 
> layers and on FF I can't ?

This must have to do with the way events are handled on SVG elements. But I cannot tell you exactly why.

> This doesn't work on FF (lower left point click is not active) but works on 
> Chrome:
> http://www.parconord.milano.it/ol_ko.html
> 
> Should I file a bug report ?

No, because having two active SelectFeature controls is not supported.

If you want smarter feature selection, have a look at http://trac.openlayers.org/changeset/9739 - this could become the way we handle feature selection in the future.

Regards,
Andreas.

> 
> -- 
> Alessandro Pasotti
> itOpen - "Open Solutions for the Net Age"
> w3:  www.itopen.it
> Linux User# 167502
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list