[OpenLayers-Users] display style.
Erik Uzureau
erik.uzureau at metacarta.com
Wed Apr 25 11:09:50 EDT 2007
Murali,
Do you have some sample code that you could paste? It's hard to debug these
sort of things without a good stack trace.
One thing that comes to mind is are you setting the width and height
properties on your map div? the getCurrentSize() function below first tries
to read clientHeight/Width but if that fails, it uses the getDimensions()
function and then as last resort style.height and style.width.
--Erik
/**
* @private
*
* @returns A new OpenLayers.Size object with the dimensions of the map
div
* @type OpenLayers.Size
*/
getCurrentSize: function() {
var size = new OpenLayers.Size(this.div.clientWidth,
this.div.clientHeight);
// Workaround for the fact that hidden elements return 0 for size.
if (size.w == 0 && size.h == 0 || isNaN(size.w) && isNaN(size.h)) {
var dim = OpenLayers.Element.getDimensions(this.div);
size.w = dim.width;
size.h = dim.height;
}
if (size.w == 0 && size.h == 0 || isNaN(size.w) && isNaN(size.h)) {
size.w = parseInt(this.div.style.width);
size.h = parseInt(this.div.style.height);
}
return size;
},
On 4/25/07, Murali Maddali <murali.maddali at uai.com> wrote:
>
> Hello All,
>
> I want to check and see if any one has seen this error before.
>
> My map is turned off or on based on display style being to set to none or
> block. On my initial page load I have the display set to none and but I am
> trying to initialize the map and trying to zoom to a given extent. When ever
> I try to zoom to a given extent I get the "element has no properties" error
> in Events.js. On further debugging I narrowed the error down to getSize
> method when it tries to calculateBounds for the current map. The current div
> is not displayed and its clientWidth and clientHeight are not returned.
>
> This is where I run into error this is within setCenter method in Map.jsfile.
>
> var bounds = this.getExtent(); //here the bounds
> are calculated from the current map and the returned bounds are invalid.
>
> //send the move call to the baselayer and all the overlays
> this.baseLayer.moveTo(bounds, zoomChanged, dragging);
> Any suggestions are greatly appreciated.
>
> Thank you all.
>
> Regards,
> Murali K. Maddali
> UAI, Inc.
> (256) 705-5191 (W)
> murali.maddali at uai.com
>
> *"Always bear in mind that your own resolution to succeed is more
> important than any one thing." - Abraham Lincoln
> *
>
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify the sender. This
> message contains confidential information and is intended only for the
> individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070425/3037a9ef/attachment.html
More information about the Users
mailing list