문제

So I've got an issue with a Google map using custom tiles, but I've managed to simplify it to the example below.

Taking the simple example Google provide with controls I've added the line

map.enableScrollWheelZoom();

This gives me the simple HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> 
  <head> 
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
    <title>Google Maps JavaScript API Example: Controls</title> 
    <script src="http://maps.google.com/maps?file=api&amp;v=2" type="text/javascript"></script> 
    <script type="text/javascript"> 
    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"))
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.enableScrollWheelZoom();
      }
    }
    </script> 
  </head> 
  <body onload="initialize()" onunload="GUnload()"> 
    <div id="map_canvas" style="width: 500px; height: 300px"></div> 
  </body> 
</html> 

All looks good until you zoom out to the maximum zoom level using the mouse wheel (viewing the whole world). Around half the time it gets stuck at the zoom level before the last. Scrolling around gives map tiles at both zoom levels.

I've tried in Chrome, IE8 and FF3.6 and they all behave the same.

Any thoughts?


Raised as a bug - http://code.google.com/p/gmaps-api-issues/issues/detail?id=2218

도움이 되었습니까?

해결책

Very odd. I was able to reproduce this bug with their sample maps too: http://gmaps-samples.googlecode.com/svn/trunk/scrollzoom/scrollzoom.htm

Enabling continuous zoom seems to fix the issue.

Add map.enableContinuousZoom(); after map.enableScrollWheelZoom();

Good luck!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top