[OpenLayers-Dev] =?gb2312?b?u9i4tDogIG9wZW5sYXllcnMgcHJvYmxlbSBp?= =?gb2312?b?biBJRTY=?=

dequan chen cdqrain at gmail.com
Sun Oct 19 08:24:39 EDT 2008


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