[OpenLayers-Dev] Problems with Canvas Renderer

Mike Ryan mr at mry4n.net
Wed Jun 27 15:01:09 PDT 2012


I've posted this problem to the users list but it probably makes more 
sense to post it here.

I'm having problems with Vector layers that use a Canvas renderer.

1. If the Canvas layer is placed below other layers (not rendered as 
Canvases) it doesn't allow click events (onFeatureSelect, etc.) to the 
overlapping layers ABOVE it.

2. If the Canvas layer has events on it they persist even when I turn 
off the Canvas layer using the LayerSwitcher and it continues to block 
the events of the layers above it.

3. The events do not persist if I turn the Canvas layer off and then pan 
the map.

I used/altered the Canvas hit detection example to verify some of the 
things above:

http://dev.openlayers.org/releases/OpenLayers-2.11/examples/canvas-hit-detection.html

My alterations to canvas.js -http://pastebin.com/tAV9Dvcx


I'm wondering if something could be altered in LayerSwitcher.js 's 
updateMap function to address this?

     updateMap: function() {
         ...
         // set the correct visibilities for the overlays
         for(var i=0, len=this.dataLayers.length; i<len; i++) {
             var layerEntry = this.dataLayers[i];
layerEntry.layer.setVisibility(layerEntry.inputElem.checked);
         }

Is it possible that setVisibility(false) when applied to a Canvas layer 
does not fully remove the layer from the map?

And even if that's correct, I still don't understand why the layer order 
is not respected.

Any thoughts?

-Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20120627/9e8be598/attachment.html>


More information about the Dev mailing list