[OpenLayers-Dev] Hover style not working on GML

Eric Lemoine eric.c2c at gmail.com
Fri Jan 11 11:36:05 EST 2008


On Jan 11, 2008 5:15 PM, Dejung Gewissler
<dejung.gewissler at oit.state.nj.us> wrote:
> Hi All-

Hi Dejung


> I've added a GML layer to the map would like the following scenario:
>     1) features rendered differently based on feature values (done with
> styles and rules)
>     2) on mouseover/hover of a feature the hover styles to take effect
>     3) on click of the feature a popup should appear
>
> 1) is done. 2) I can't get to work unless I attach a selectFeature
> control to the layer and set {hover: true}. Is there a way to accomplish
> this task without using the selectFeature control?

Not that I'm aware of. But I understand why you're asking this - the
hover* style properties. I've never use these properties myself, and I
don't know if they're actually usable. Someone may want to jump in...

> The reason why is
> that I would like to use the selectFeature control in 3) and attach some
> functionality to the onSelect callback.

Have you tried using two select feature controls on the same layer,
one with hover:true, the other with hover:false? Again, I've never
tried this myself, and I'm not actually sure it'll work. If that
doesn't work, I'd say it's a bug in OpenLayers, and we'll need to fix
it.

> In addition when I set {hover:
> true} on the selectFeature control the hover styles are not being
> honored. They default to blue for both stroke and fill.

Yeah, the selectStyle property of the select feature control matters
here. Again, I don't know whether these hover* properties are usable
(I dont think they are, but I may be wrong).

Hope this helps,

--
Eric



More information about the Dev mailing list