删除街景控件

时间:2015-03-23 22:35:11

标签: javascript api google-street-view

我正在开发我开发的应用程序的前端,并希望从此处显示的Google StreetView嵌入中删除控件:

function displayGoogleSV(address_str) {
var geocoder = new google.maps.Geocoder();
var myStreetView = null;

var marker = null;

var address = address_str;
geocoder.geocode({
'address': address
}, function (results, status) {
//alert (results);
if (status == google.maps.GeocoderStatus.OK) {
//alert(results[0].geometry.location);
myStreetView = new google.maps.StreetViewPanorama(document.getElementById("streetview"));
myStreetView.setPosition(results[0].geometry.location);
google.maps.event.addListenerOnce(myStreetView, 'status_changed', function () {
var heading = google.maps.geometry.spherical.computeHeading(myStreetView.getLocation().latLng, results[0].geometry.location);
myStreetView.setPov({
heading: heading,
pitch: 0
});

我会在哪里看到这里看到的控件:https://developers.google.com/maps/documentation/javascript/examples/streetview-controls

谢谢!

1 个答案:

答案 0 :(得分:0)

您应该使用街景视图选项中的链接选项停用它们:

/* ... */
myStreetView.setPov({
    heading: heading,
    pitch: 0
});

var panoOptions = {
    addressControlOptions: {
      position: google.maps.ControlPosition.BOTTOM_CENTER
    },
    linksControl: false,
    panControl: false,
    zoomControlOptions: {
      style: google.maps.ZoomControlStyle.SMALL
    },
    enableCloseButton: false
};

myStreetView.setOptions( panoOptions );