0

我正在尝试使用 GMaps,但我想避免这种行为:

在此处输入图像描述

我不想限制缩放。我想限制世界地图的重复。

有没有办法做到这一点?

4

2 回答 2

0

在您的MapOptions对象中,放置一个minZoom. 3 应该这样做,但这取决于您映射 div 的大小:

   var myOptions = {
          center: new google.maps.LatLng(-34.397, 150.644),
          zoom: 3,
          minZoom:3,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
于 2012-06-22T23:34:29.517 回答
0

Without restricting zoom, I have seen artificial workarounds. It depends how you have your page set up.

If the map takes up the whole width of the webpage, I think changing the div's width on zoom change is best.

If you have content around the map, you can try setting up gray div "curtains" that block part of the original map's div, so it appears that the map viewport shrunk. The big disadvantage is you will have to cover up the map controls if the viewport needs to stay centered.

See sample code here: mutiple occurance of single country in google map

于 2012-06-22T23:45:39.777 回答