admin管理员组文章数量:1420339
I'm using the Google Maps JavaScript API v3. Is it possible to disable/hide all street view UI in google maps?
I tried
disableDefaultUI: true
in the map options but doesn't disable the UI in street view.
I'm using the following code to display street view on a click marker event:
service.getPanoramaByLocation(marker.getPosition(), 200, function(result, status) {
if (status == google.maps.StreetViewStatus.OK) {
var panorama = map.getStreetView();
panorama.setPosition(result.location.latLng);
panorama.setVisible(true);
disableDefaultUI: true;
} else {
alert("No street view is available within " + 200 + " meters");
return;
}
});
I'm using the Google Maps JavaScript API v3. Is it possible to disable/hide all street view UI in google maps?
I tried
disableDefaultUI: true
in the map options but doesn't disable the UI in street view.
I'm using the following code to display street view on a click marker event:
service.getPanoramaByLocation(marker.getPosition(), 200, function(result, status) {
if (status == google.maps.StreetViewStatus.OK) {
var panorama = map.getStreetView();
panorama.setPosition(result.location.latLng);
panorama.setVisible(true);
disableDefaultUI: true;
} else {
alert("No street view is available within " + 200 + " meters");
return;
}
});
Share
Improve this question
asked Feb 2, 2014 at 3:09
CyberJunkieCyberJunkie
22.7k61 gold badges154 silver badges219 bronze badges
1
-
1
disableDefaultUI: true;
will produce a syntax error. What exactly do you want to disable? – Salman Arshad Commented Feb 2, 2014 at 9:22
3 Answers
Reset to default 3You have to use map option streetViewControl
and set it to false
like:
var mapOptions = {
zoom: 15,
center: new google.maps.LatLng(52.5, 13.4),
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false
};
You might want to check this: https://developers.google./maps/documentation/javascript/reference#StreetViewPanoramaOptions
var panoramaOptions = {
disableDefaultUI: true
};
panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions);
Here is a demo.
If you are in angular 8 you can do it in the following way:
"@angular/google-maps": "^10.1.3", --> package.json
<google-map width="100%" height="100%" [center]="center" [zoom]="zoom"
[options]="mapOptions">
The options to use are:
mapOptions = {
fullscreenControl: false,
disableDefaultUI: true
};
本文标签: javascriptGoogle Maps API disable street view UIStack Overflow
版权声明:本文标题:javascript - Google Maps API disable street view UI - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744744355a2622798.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论