gmaps4rails 添加缩放控件



我正在使用最新的gmaps4rails,我想在地图上添加缩放控件。我看了一下 API 并尝试像这样设置原始选项:

= gmaps({"map_options" => { :raw => "{scrollwheel: false, 
         disableDefaultUI: false, zoomControl: true, panControl: true, 
         zoomControlOptions: {style: google.maps.ZoomControlStyle.LARGE }}"},
         :markers => {:data => @json}})

不过,这不会在地图上显示任何控件。

要显示地图缩放控件,我该怎么做?

使用:

Gmaps.search_map.map_options.raw.zoomControl = true; // yes, raw

更多选项: https://developers.google.com/maps/documentation/javascript/reference#MapOptions

最新更新