gpt4 book ai didi

javascript - 如何以编程方式启用/禁用 Google 街景中的箭头控制?

转载 作者:行者123 更新时间:2023-12-03 04:15:20 24 4
gpt4 key购买 nike

我正在使用 Google 街景和 HTML/Javascript 构建一个 Web 应用程序。

我想启用/禁用图像上的箭头控件。

我无法展示执行此操作的示例...

建议/示例?

最佳答案

我是这样解决的...

<html>
<head>
<meta charset="utf-8">
<title>test Street View</title>

<style>
html, body {
min-height: 100%;
min-width: 100%;
margin: 0;
padding: 0;
}
table {
width: 95vw;
height: 95vh;
}
td {
width: 50%;
height: 50%;
}
</style>
</head>
<body>
<div id="maps-images">
<center>
<table border=1>
<!-- first row -->
<tr id="row1">
<td id="g_map">
<div id="google_map" style="width:100%;height:100%"></div>
</td>
<td id="google-street-view">
<div id="google-street-view_images" style="width:100%;height:100%"></div>
</td>
</tr>
</table>
</center>
</div>

<script>
var panorama;

function initialize() {
//### The original pegman position ...
var pegman_position = {lat: 42.628386111111126, lng: 13.291408333333237};
var marker;

//### Add Google Map ...
var google_map = new google.maps.Map(document.getElementById('google_map'), {
center: pegman_position,
zoom: 16
});

//### Add Google Street View ...
window.panorama = new google.maps.StreetViewPanorama(
document.getElementById('google-street-view_images'), {
position: pegman_position,
pov: {
heading: 34,
pitch: 10
}
});
google_map.setStreetView(window.panorama);

//### Modify Street View controls ...
var panoOptions = {
scrollwheel: false,
disableDefaultUI: true,
clickToGo: false
};
window.panorama.setOptions(panoOptions);

}
</script>

<script async defer
src="https://maps.googleapis.com/maps/api/js?key=<PUT_YOUR_APIKEY_HERE&callback=initialize">
</script>

</body>
</html>

在本节中,我配置了选项...

       //### Modify Street View controls ...
var panoOptions = {
scrollwheel: false,
disableDefaultUI: true,
clickToGo: false
};
window.panorama.setOptions(panoOptions);

现在我能够管理如何启用/禁用街景图像上的控件...

关于javascript - 如何以编程方式启用/禁用 Google 街景中的箭头控制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44164420/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com