var overlay = null;
function update_map() {
if (overlay == null) {
overlay = new google.maps.OverlayView();
overlay.draw = function() {};
overlay.setMap(map);
}
var center = map.getCenter();
if (prevCenter && map.getZoom() == prevZoom) {
var point1 = overlay.getProjection().fromLatLngToContainerPixel(center);
...--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/jzlxFB2Vjf0J.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
overlay = new google.maps.OverlayView();
overlay.draw = function() {};
overlay.setMap(map); var x = (200 - divwidth) / 2;
var y = 50;
var latLng = overlay.getProjection().fromDivPixelToLatLng(new google.maps.Point(x,y));If I place a marker at that latlng, it doesn't seem to work.Is there some kind of 'wait' needed before the overlay can be used? And am I usiing google.maps.Point in the right way?Thanks again
We dont know what context you are calling that. Is the Map definitly
existing when that code is called?
All be weary of calling that many times in a row. If you create the
overlay each time, you going to end up with lots of invisible overlays
added to the map - eventually slowing performance.
Your calling of google.maps.Point looks ok at first glance
On Fri, Oct 28, 2011 at 7:23 PM, pinksy <pink...@gmail.com> wrote:
> Thanks for the reply Barry. I'm not quite sure I completely understand - do
> you mean something like this (which doesn't appear to work)?:
>
> overlay = new google.maps.OverlayView();
> overlay.draw = function() {};
> overlay.setMap(map);
>
> var x = (200 - divwidth) / 2;
>
> var y = 50;
>
> var latLng = overlay.getProjection().fromDivPixelToLatLng(new
> google.maps.Point(x,y));
>
> If I place a marker at that latlng, it doesn't seem to work.
>
> Is there some kind of 'wait' needed before the overlay can be used? And am I
> usiing google.maps.Point in the right way?
>
> Thanks again
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-maps-js-api-v3/-/BipylqUZNbsJ.