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

Julien-Samuel Lacroix jlacroix at mapgears.com
Tue May 3 16:24:57 EDT 2011


I finally addressed this issue. I open a ticket for this and attached a 
patch to fix the problem.


Let me know if I did the right thing.


On 11-04-16 06:59 AM, Eric Lemoine wrote:
> 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,

Julien-Samuel Lacroix

More information about the Dev mailing list