[OpenLayers-Users] Canvas Vector Layer Turns Off After Panning

Mike Ryan mr at mry4n.net
Wed Jun 27 13:33:37 PDT 2012


A new piece of the puzzle:

If I turn off the layer, and click in the spot where the feature used to 
be, the popup appears.

If I turn off the layer, pan the map, and then click the spot where the 
feature should be (in its new position) the popup does not appear and 
allows click events to layers underneath the Canvas layer.

Any idea why the Canvas layer somehow stays on the map unless I pan the 
map?

I'm looking at the LayerSwitcher code to see how exactly it turns a 
layer off to see if something can be added there to completely wipe away 
the canvas.

-Mike

Message: 1
Date: Wed, 27 Jun 2012 14:49:08 -0400
From: Mike Ryan<mr at mry4n.net>
To:openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] Vector Layer w/ Canvas Renderer Not
	Respecting Other Layers
Message-ID:<4FEB55A4.70304 at mry4n.net>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

Following up on this, since I haven't heard anything. I've played around
with the canvas hit detection example here:

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

and did the following:

- made an overlay layer with some of features so that I could turn the
layer on/off
- added the LayerSwitcher control to the map
- added onFeatureSelect and onFeatureUnselect events to the layers so a
popup appears when you click on the features
- the popups appear when clicking on the visible features
- AND the popups appear when clicking on the "invisible" features in the
overlay when it is TURNED OFF

So, is this an issue with the HTML5 Canvas element itself or the way OL
uses it to render Vector layers?

Does turning a Canvas layer "off" via LayerSwitcher require some extra code?

-Mike


On 6/26/2012 1:42 PM, Mike Ryan wrote:

> When I add a Vector layer using a Canvas renderer two bad things happen:
>
> 1. Other Vector layers with points that have click events attached and
> are within the area covered by the Canvas layer are no longer
> clickable. The Canvas layers is blocking the click event.
>
> If a click event was added to the Canvas layer, the Canvas click event
> is fired rather than the point's in the other layer.
>
> Points in the other layer that are not within the Canvas layer area
> work properly.
>
> 2. Even when I switch off the Canvas layer with the layerswitcher, the
> Canvas layer still behaves the same way -- even though the canvas
> layer can no longer be seen.
>
> Who's got an idea of what might be going on here?
>
> -Mike

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120627/2b66c036/attachment.html>


More information about the Users mailing list