Hi,

 

I used to following example to create a custom overlay:

http://code.google.com/apis/maps/documentation/overlays.html#Custom_Overlays

 

this example describes a method of dynamically aligning the overlay's div
with the map pane div using the following method:


  // Calculate the DIV coordinates of two opposite corners of our bounds to
  // get the size and position of our rectangle
  var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest());
  var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast());

  // Now position our DIV based on the DIV coordinates of our bounds
  this.div_.style.width = Math.abs(c2.x - c1.x) + "px";
  this.div_.style.height = Math.abs(c2.y - c1.y) + "px";
  this.div_.style.left = (Math.min(c2.x, c1.x) - this.weight_) + "px";
  this.div_.style.top = (Math.min(c2.y, c1.y) - this.weight_) + "px";

 

Ive attempted to implement this method in my custom overlay, and it seems to
work fine for the most part.

However, it fails at zoom level 1, since the values being returned by the
'fromLatLngToDivPixel()' function calls don't seem to be correct.

 

Here's my url:

http://mexsurf.com/test/maptst2.html

 

the map starts at zoom 2, which works fine, but switching to zoom 1 will
produce bad values for my overlay div's dimensions.

below the map you'll se where Ive output these values.

 

Question:

What method should I use, or how should the previous method be corrected, to
properly calculate the overlay div's dimensions for a redraw, including at
zoom level 1?

 

Please help,

 

Thanks,

P.Romero


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to