[OpenLayers-Dev] openlayers problem in IE6

Eric Lemoine eric.c2c at gmail.com
Sun Oct 19 10:27:25 EDT 2008


First of all, I have no solution to your IE6 problem at this point.

Second of all, the "official" way to register listeners on feature
click and hover is to use the select feature control. And, as often
mentioned on the list, that control does not support multi-layer
feature selection (only the features of the layer on the top can be
selected).

Now, what you're telling us here is very interesting! (At least to
me.) You're saying that by registering event listeners on the layers
themselves instead of the map, multi-layer feature selection can work
(the IE6 problem aside). After a bit of thinking it makes perfect
sense to me. I had never realized that, I'd be curious if others had?!

And this makes me wonder if we could tweak our handler code a bit so
that it support registering listeners on some other object than the
map object. With that we could have the feature handler actually
register listeners on the layer object. I'd be interested to get some
feedback on that before I go play around with that idea. And there's
this IE6 issue, but who knows... we may find a workaround.

Dequan chen, sorry for not being able to help you!

Eric

2008/10/19, dequan chen <cdqrain at gmail.com>:
> var lineLayer = new OpenLayers.Layer.Vector("Line Layer");
> lineLayer.events.register("mouseover", lineLayer, function(e)
> 	{
> 		this.div.style.cursor = "pointer";
> 		var feature = this.getFeatureFromEvent(e);
> 		if(feature)
> 			alert(feature.attributes.name);
> 	});
> var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
> polygonLayer.events.register("mouseover", polygonLayer, function(e)
> 	{
> 		this.div.style.cursor = "pointer";
> 		var feature = this.getFeatureFromEvent(e);
> 		if(feature)
> 			alert(feature.attributes.name);
> 	});
> map.addLayer(lineLayer);
> map.addLayer(polygonLayer);
>
> in this example, the polygonLayer will cover the lineLayer. the
> polygonLayer's 'mouseover' event can be triggered, and alert
> something. but when i mose move to the line feature in lineLayer, the
> mouse cursor can become to 'pointer'. but the 'alert' function can not
> be invoked. it means the feature what i want to get has not been
> chosed.
> all of the features can be displayed normally.
> IE7 FF do not have this issue.
> thanks in advance. :-)
>
> 2008/10/19, Eric Lemoine <eric.c2c at gmail.com>:
>> Hi. With multiple vector layers events work only for the elements of
>> the layer on top of the others. I'm suprised you're observing
>> different behavior on IE6, IE7 and FF with that respect. A simple
>> example would help us understand the issue. Eric
>>
>> 2008/10/16, dequan chen <cdqrain at gmail.com>:
>>> hi.
>>> I use more than one openlayers vector layer to overlay the map. every
>>> layer
>>> has its event. in IE6, the upper layer covers completely the lower layer.
>>> so, the other vector layer event can not be triggered. in IE7 or firefox,
>>> there's no this issue.
>>> I try to render the vector layer div border, and find the div fill the
>>> entire map. in IE7 or firefox, the border shrinks to the top left corner.
>>> so
>>> the layer don't cover the lower layer.
>>> how to solve this problem ? thanks. :-)
>>>
>>
>



More information about the Dev mailing list