0
我搞糊涂了,试图改变地图控件,就像上面说的here但是不知道如何使用gmaps4rails gem来实现。如何使用Gmaps4rails gem自定义地图控件?
我只想离开缩放和平移控制,并删除所有其他人。但js控制台说:
>> Gmaps.map.map.mapTypeControl
>> false
但它仍然存在于地图上。
我搞糊涂了,试图改变地图控件,就像上面说的here但是不知道如何使用gmaps4rails gem来实现。如何使用Gmaps4rails gem自定义地图控件?
我只想离开缩放和平移控制,并删除所有其他人。但js控制台说:
>> Gmaps.map.map.mapTypeControl
>> false
但它仍然存在于地图上。
您可以使用raw
参数发送您需要的任何地图选项。 See doc。
我想,你应该做的:
<%= gmaps(:map_options => { :raw => '{ panControl: true,
zoomControl: true,
mapTypeControl: false,
scaleControl: false,
streetViewControl: false,
overviewMapControl: false}'
},
:markers => { :data => @json }
)%>
如果您正在使用的JavaScript(不与<%= gmaps %>
)初始化,使用
Gmaps.search_map.map_options.raw.streetViewControl = false;
更多选择here
使用上述原料的选择,我可以隐藏除使用条款之外的所有内容。你能帮我隐藏这个使用条款链接,同时呈现地图吗?谢谢。 –
这很好。谢谢! – mrudult