[OpenLayers-Users] Popup to fill viewport

Richard Jones richardjnz at yahoo.com
Mon Aug 6 04:57:53 PDT 2012


I need to create a OpenLayers.Popup which fills the whole viewport (so that I can covering the map temporarily).
I discovered by accident that passing null as the lonlat position parameter of the constructor makes the popup top-left positioned at pixel 0,0 of the viewport. So the constructor below creates a popup which covers the whole viewport - exactly what I want:
var popup = new OpenLayers.Popup(null, null, map.getSize(),					  "<h1>My message text</h1>",                                          false,                                          null);map.addPopup(popup);
and when the window gets resized I just have to call
popup.setSize(map.getSize());
which makes it cover the whole of the new viewport area.
But passing null as the lonlat parameter is not mentioned in the documentation, so is this behaviour by design and I can safely use it, or is it just an unexpected behaviour that is unsafe to use?
I would have expected the constructor to fail if it was passed an unsupported argument type.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120806/9e733bce/attachment.html>


More information about the Users mailing list