Yep. But it will work as expected if you swap the order in SelectFeature. Of course, needing to do that is not expected.

Not that this might not be a nice feature to have. It could actually be very useful be able to click features underneath a layer.

-Mike

On 7/11/2012 3:00 PM, [email protected] wrote:
True!

But the original example also wrong using Canvas: using SVG can not select a
markers if it is below a square, with Canvas you can, as if there were no
rectangle!

Xavier


m1k3ry4n wrote
>
>When I render a layer as a Canvas it no longer respects the layer index.
>
>In my case, the Canvas layer is made up of polygons and a separate layer
>above it is made up of points. Any points within polygons cannot be
>selected -- only the surrounding polygon gets selected.
>
>I do not have this problem if the polygon layer is rendered as something
>other than a Canvas.
>
>This problem is caused by the order of the layers in the array sent to
>OpenLayers.Control.SelectFeature. The workaround is ordering the layers
>array so that the Canvas layer comes after layers that are above it in
>the layer index.
>
>In other words, even though I add layers to the map like this:
>map.addLayers([canvas_layer, point_layer])
>
>I have to add layers to the control like this:
>map.addControl(new OpenLayers.Control.SelectFeature([point_layer,
>canvas_layer]))
>
>To reproduce this problem do the following.
>
>1. Go to:
>http://openlayers.org/dev/examples/select-feature-multilayer.html?renderer=Canvas
>
>2. Swap the order of vectors1, vectors2 in lines 62 & 65 so they look
>like this:
>
>(line 62) map.addLayers([wmsLayer, vectors2, vectors1]);
>...
>(line 65) selectControl = new OpenLayers.Control.SelectFeature(
>                  [vectors2, vectors1],
>
>Changing addLayers puts the markers above the squares. Changing
>SelectFeature disallows markers within squares to be selected, even
>though they are above the squares. You will only see this problem if you
>render the layers as Canvases (i.e. include "?renderer=Canvas" in the
>url).
>
>Considering that layer order in SelectFeature has no effect on layers
>not rendered as Canvases, this is either a bug or requires some
>documentation for SelectFeature.
>
>This was also an issue in OL 2.11, but 2.12 improved the situation. In
>2.11 if you turned off the Canvas layer it persisted even though you
>could not see the layer! If you panned the map, it would finally go away
>and you could click the  layers below.
>
>-Mike
>
>
>Reference:
>OpenLayers.Control.SelectFeature
>http://dev.openlayers.org/docs/files/OpenLayers/Control/SelectFeature-js.html#OpenLayers.Control.SelectFeature.OpenLayers.Control.SelectFeature
>
>OpenLayers Select Feature on Multiple Layers Example
>http://openlayers.org/dev/examples/select-feature-multilayer.html?renderer=Canvas
>
>


_______________________________________________
Dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev

Reply via email to