在相机移动之前,标记不会显示在 Google 街景视图中
Markers not showing in Google Street View until the camera moves
第一次激活街景模式时,Google 地图街景全景图中不会显示标记,直到移动相机(改变位置或四处移动)。甚至 Google's own example 在最新的 3.31 API 版本的多个浏览器(FF、IE、Chrome)以及 Android 上的几台 PC 和 Chome 中也表现出这种行为,所以它看起来像一个错误。
有什么解决方法吗?
重现该行为的方法如下:
- 前往 "Overlays within Street View" example.
- 单击 "Toggle Street View" 按钮。
- 观察到没有引脚存在。
- 稍微移动相机,看到咖啡杯别针出现。
这是我用来切换到街景视图的代码:
var panorama = map.getStreetView();
panorama.setPosition(<position>);
panorama.setPov(<pov>);
panorama.setVisible(true);
一些可以显示标记的东西:
- 使用街景小人切换到街景
- 延迟 1 秒后设置 POV 有时 有效
一旦标记在街景视图中显示(例如使用街景小人或相机移动),它们将继续显示,即使在地图和街景模式之间来回切换时也是如此。如果刷新页面,未显示行为 returns.
我已经尝试过多种浏览器、操作系统和硬件。如果您看到与我不同的结果,请 post 对您的 broswer/OS/cpu?/graphics?.
发表评论会有所帮助
事实证明this is a bug in Street View, Google is aware of it, and there is a workaround:在setVisible(true)
之前调用setZoom(1)
。
设置初始全景 zoom
选项对我有帮助:
const panorama = map.getStreetView();
panorama.setOptions({
...
zoom: 0,
});
第一次激活街景模式时,Google 地图街景全景图中不会显示标记,直到移动相机(改变位置或四处移动)。甚至 Google's own example 在最新的 3.31 API 版本的多个浏览器(FF、IE、Chrome)以及 Android 上的几台 PC 和 Chome 中也表现出这种行为,所以它看起来像一个错误。
有什么解决方法吗?
重现该行为的方法如下:
- 前往 "Overlays within Street View" example.
- 单击 "Toggle Street View" 按钮。
- 观察到没有引脚存在。
- 稍微移动相机,看到咖啡杯别针出现。
这是我用来切换到街景视图的代码:
var panorama = map.getStreetView();
panorama.setPosition(<position>);
panorama.setPov(<pov>);
panorama.setVisible(true);
一些可以显示标记的东西:
- 使用街景小人切换到街景
- 延迟 1 秒后设置 POV 有时 有效
一旦标记在街景视图中显示(例如使用街景小人或相机移动),它们将继续显示,即使在地图和街景模式之间来回切换时也是如此。如果刷新页面,未显示行为 returns.
我已经尝试过多种浏览器、操作系统和硬件。如果您看到与我不同的结果,请 post 对您的 broswer/OS/cpu?/graphics?.
发表评论会有所帮助事实证明this is a bug in Street View, Google is aware of it, and there is a workaround:在setVisible(true)
之前调用setZoom(1)
。
设置初始全景 zoom
选项对我有帮助:
const panorama = map.getStreetView();
panorama.setOptions({
...
zoom: 0,
});