[OpenLayers-Dev] getDimensions: whether or not it should update
the css display attribute
eric.lemoine at camptocamp.com
Tue Jan 26 03:17:35 EST 2010
On Thu, Jan 14, 2010 at 11:40 AM, Bruno Binet
<bruno.binet at camptocamp.com> wrote:
> Hi devs,
> I recently came across a bug in OpenLayers that causes Element
> getDimensions method to unexpectedly set a display:none on the map
> It occured when updateSize was called on the map while map div was
> already display:none (from a css class).
> The ticket #2414  is reporting the problem.
> In my opinion, getDimensions should not set a css attribute to get the
> real dimensions of an element. I don't like the idea of a "get" method
> to set attributes. If a element is display:none, then getDimensions
> should return 0.
> When looking at svn history, getDimensions comes from Prototype
> framework, and this method is only used in Map.js in getCurrentSize
> method, and getCurrentSize is only used in updateSize method and
> Layer/MapGuide.js (which I think should use map.size instead).
> I'd support the idea of removing the code which temporary make the
> element regain its original size, and letting the web application in
> charge of manually calling updateSize when display:none is removed
> from the map div.
> But the current behaviour comes from the beginning of OpenLayers ,
> so there may be good reasons for it?
I don't see any good reason for it. So I agree with having
getDimensions return 0 when display is none.
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
More information about the Dev