[OpenLayers-Dev] Adding a vector layer to an invisible map

Eric Lemoine eric.lemoine at camptocamp.com
Sat Apr 16 06:59:27 EDT 2011


On Friday, April 15, 2011, Julien-Samuel Lacroix <jlacroix at mapgears.com> wrote:
> Hello,
>
> I'm trying to add a vector layer to a map on an undisplayed element. I get an error in 2.10 and it was working in 2.7.
>
> After looking at the code it seems related to:
>  http://trac.osgeo.org/openlayers/ticket/2414
>
> It's working with 2.7 and 2.8 and started to fail at 2.9.
>
> I attached a patch that add a test for this. Is this relevant?
> I'm not sure what's the right way to fix this. Fix getCurrentSize() or fix Renderer.js to validate if the size is valid.


I think we should fix Renderer and guard against "invalid" map sizes
(I haven't looked ar what it would look like yet).

Here's what the app developper should be able to do:

mapdiv.style.display = "none";
map = new OpenLayers.Map(mapdiv);
map.addLayer(new OpenLayers.Layer.Vector(""));
mapdiv.style.display = "block";
map.updateSize();

I think it'd be great to fix that before 2.11 final.

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Dev mailing list