我正在使用谷歌地图作为轨道,并且我已经正确设置了所有内容,但我似乎无法弄清楚如何设置默认缩放数字。我尝试在 gmaps4rails.base.js.coffee 中设置它:
@default_map_options =
id: 'map'
draggable: true
detect_location: false # should the browser attempt to use geolocation detection features of HTML5?
center_on_user: false # centers map on the location detected through the browser
center_latitude: 0
center_longitude: 0
zoom: 7
maxZoom: null
minZoom: null
auto_adjust : true # adjust the map to the markers if set to true
auto_zoom: true # zoom given by auto-adjust
bounds: [] # adjust map to these limits. Should be [{"lat": , "lng": }]
raw: {} # raw json to pass additional options
但我认为这不能正常工作。创建地图时有没有办法添加缩放数字:
<%= gmaps(:markers => {:data => @json,
:options => {:raw => '{ animation: google.maps.Animation }' } },
:map_options => { :raw => '{ disableDefaultUI: false,
scrollwheel: true }' }) %>
我所做的一切似乎都没有做任何事情,它总是一直放大。谢谢!