0

我在我的页面上显示了一些小地图,我用标记集群显示标记。从Google地图中删除控件

我真的不希望任何缩放或其他工具显示在这张地图上。部分原因是工具甚至无法正确显示(不管画布的大小)。

我使用gmaps4rails宝石

这里是什么,我现在有一个画面:

enter image description here

我想删除我封锁了红:

enter image description here

这里是我的编码:

<div style='padding: 6px; 
     border-width: 1px; 
     border-style: solid; 
     border-color: #ccC#ccC#999 #ccc; 
     -webkit-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px; 
     -moz-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px; 
     box-shadow: rgba(64, 64, 64, 0.1) 0 2px 5px; 
'> 
    <div id="map2" style='width: 450px; height: 200px;'></div> 
</div> 

<script type="text/javascript"> 
    handler2 = Gmaps.build('Google', { markers: { clusterer: {gridSize: 50, maxZoom: 5} } }); 
    handler2.buildMap({ provider: {}, internal: {id: 'map2'}}, function(){ 
     handler2.addMarkers(<%=raw @hash2.to_json %>); 
     handler2.getMap().setZoom(3); 
     handler2.map.centerOn([39.828127,-98.579404]); 
    }); 
</script> 
+0

你试过[谷歌](https://www.google.com/search?q=remove+controls+from+google +图)? – 2014-10-29 16:34:57

回答

2

根据google maps doc,你可以用disableDefaultUI做到这一点。

所以通过它在提供对象:

provider: {disableDefaultUI: true } 

See plunkr

+0

谢谢你treudyously ...我已经看到disableDefaultUI:真,但不知道如何实现它到我编码的编码...我一直看到它在mapOptions = {}我猜mapOptions可以在提供者:{ } 部分。 – 2014-10-29 16:38:59