是否可以将铯球移到中心右侧?
Is it possible to shift the Cesium globe to the right of center?
是否可以将地球仪移动到中心的左侧或右侧?我想在透明导航侧边栏下方显示星空,并将地球向右移动等于侧边栏宽度的距离。
我找不到这方面的任何示例,也没有看到对 Cesium 中现有方法的引用。我尝试使 Cesium div 比其容器大,并使用定位使地球看起来向右移动,但这显示星空由于放大而变得模糊。
是的,从 UI 开始,这是通过按住 SHIFT 键并拖动来完成的,但在代码中可以使用相机上的 lookLeft and lookRight 方法来完成。
例如:
viewer.camera.lookLeft(Cesium.Math.toRadians(20));
这里有一个更完整的示例,请在底部按 "Run Code Snippet":
var viewer = new Cesium.Viewer('cesiumContainer', {
// All these construction options are just to avoid Stack Snippet error messages.
navigationInstructionsInitiallyVisible: false, animation: false, timeline: false,
imageryProvider : Cesium.createTileMapServiceImageryProvider({
url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')
}),
baseLayerPicker : false,
geocoder : false,
infoBox : false
});
// This changes where the Earth is seen by the camera.
viewer.camera.lookLeft(Cesium.Math.toRadians(20));
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
font-family: sans-serif;
}
<link href="http://cesiumjs.org/releases/1.55/Build/Cesium/Widgets/widgets.css"
rel="stylesheet"/>
<script src="http://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js">
</script>
<div id="cesiumContainer"></div>
是否可以将地球仪移动到中心的左侧或右侧?我想在透明导航侧边栏下方显示星空,并将地球向右移动等于侧边栏宽度的距离。
我找不到这方面的任何示例,也没有看到对 Cesium 中现有方法的引用。我尝试使 Cesium div 比其容器大,并使用定位使地球看起来向右移动,但这显示星空由于放大而变得模糊。
是的,从 UI 开始,这是通过按住 SHIFT 键并拖动来完成的,但在代码中可以使用相机上的 lookLeft and lookRight 方法来完成。
例如:
viewer.camera.lookLeft(Cesium.Math.toRadians(20));
这里有一个更完整的示例,请在底部按 "Run Code Snippet":
var viewer = new Cesium.Viewer('cesiumContainer', {
// All these construction options are just to avoid Stack Snippet error messages.
navigationInstructionsInitiallyVisible: false, animation: false, timeline: false,
imageryProvider : Cesium.createTileMapServiceImageryProvider({
url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')
}),
baseLayerPicker : false,
geocoder : false,
infoBox : false
});
// This changes where the Earth is seen by the camera.
viewer.camera.lookLeft(Cesium.Math.toRadians(20));
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
font-family: sans-serif;
}
<link href="http://cesiumjs.org/releases/1.55/Build/Cesium/Widgets/widgets.css"
rel="stylesheet"/>
<script src="http://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js">
</script>
<div id="cesiumContainer"></div>