Here is my solution, I only need isFullLng (), which, apparently, has been removed from the v3 API:
isFullLng: function() { var scale = Math.pow(2, map.getZoom()), bounds = map.getBounds(), ne = bounds.getNorthEast(), sw = bounds.getSouthWest(), lat = (ne.lat() <= 0 && sw.lat() >= 0) || (ne.lat() >= 0 && sw.lat() <= 0) ? 0 : Math.min(Math.abs(ne.lat()), Math.abs(sw.lat())), // closest latitude to equator deg1 = new google.maps.LatLng(lat, 0), deg2 = new google.maps.LatLng(lat, 1), coord1 = map.getProjection().fromLatLngToPoint(deg1), coord2 = map.getProjection().fromLatLngToPoint(deg2); // distance for one long degree in pixels for this zoom level var pixelsPerLonDegree = (coord2.x - coord1.x) * scale; // width of map holder should be <= 360 (deg) * pixelsPerLonDegree if full map is displayed var width = $this.width(); // width of map holder div return pixelsPerLonDegree * 360 <= width; }, isFullLat: function() { var bounds = map.getBounds(), ne = bounds.getNorthEast(), sw = bounds.getSouthWest(), maxLat = 85; // max lat degree return ne.lat() >= maxLat && sw.lat() <= -maxLat; },
So, isFull could be:
isFullLng () && isFullLat ()
Note that in isFullLng () the width of the map placeholder is required, I use jQuery and the map is displayed in the div referenced by $ this, so I call
$ this.width ()
You should change this to apply it to your problem.
cotko
source share