[OpenLayers-Users] click/hover select controls on one layer

Andreas Hocevar ahocevar at opengeo.org
Thu Feb 18 12:50:30 EST 2010


Hi Rob,

Robert Marianski wrote:
> I want to be able to handle both hover and click events on features in a
> vector layer. I created two select controls, one with hover set to true,
> added them to the layer, and activated them.
> 
> What I'm seeing is that the click select control doesn't receive any of
> featured selected events, but the hover select control does receive the
> hover events. If I don't add the hover select control but only the click
> select control, then I do receive all the click events.

This is because by default, hovering over a feature also selects it. You 
can change that easily by configuring the one that you use for hover with

highlightOnly: true

Hope this helps,
Andreas.

> 
> Am I approaching this the wrong way? Any workarounds? I'm using the
> nightly openlayers build from 2/17/10.
> 
> Thanks,
> Robert
> _______________________________________________
> 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