[OpenLayers-Users] autosizing popup containing image does not work in firefox

Christopher Schmidt crschmidt at metacarta.com
Wed Jul 22 16:52:46 EDT 2009


On Wed, Jul 22, 2009 at 10:47:46PM +0200, arno wrote:
> Hi,
> I want to show a popup containing an image. I want it to size automatically 
> depending on content (ie: mainly image width and height); so, I use autoSize 
> property for popup.
> 
> But popup size is not computed correctly in firefox, it's really too small. It 
> looks like image dimensions are not part of computed dimensions:
> http://renevier.net/misc/ol_autosizeimg.html
> (click anywhere on the map to display a popup)
> 
> Once image is in cache, dimensions are computed correctly. So, if I reload 
> given page, popup will display correctly.
> 
> dimensions are computed in OpenLayers.Util.getRenderedDimensions by getting 
> popup innerHTML, injecting it in an html element, and checking its 
> scrollWidth and scrollHeight properties. Image is not loaded when returning 
> from this function, and my guess is its dimensions are unknown to firefox at 
> that moment.
> 
> Do you think there's a workaround for that ?

For me, what happens, in Safari and Firefox, is I click, a popup opens,
an dit's too small. THe iamge loads, and when the image loadend event
occurs, the popup resizes. the popup does not seem to want to make the
map scroll (but I don't think the anchored popups do that) so it's still
somewhat too small, but the image stays the same after it is oaded and
when i click again.

So, for me, this seems to work. Is this not the behavior you're seeing?

-- Chris


> thanks
> arno



> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list