cesium - 信息框为空
问题描述
动态选择元素后,我的 Cesium 信息框为空。
这就是我选择元素的方式。
public selectById(id: string): void {
console.log('selecting ' + id);
if (id != null) {
// this.viewer is Cesium.Viewer => https://cesiumjs.org/Cesium/Build/Documentation/Viewer.html?classFilter=viewer
this.viewer.selectedEntity = this.viewer.entities.getById(id);
// viewer.flyTo messes up the camera pitch
this.viewer.camera.flyTo({destination: this.viewer.selectedEntity.position.getValue(Cesium.JulianDate.now())});
}
}
实体被选中,相机飞到它就好了,Cesium信息框在标题中显示实体名称就好了,但不显示描述。如果我通过单击选择实体,该框会很好地显示描述。
我找不到任何东西来强制 InfoBox 重绘,或者看到我需要为 InfoBox 更新设置的任何其他内容。那么我错过了什么?
- 我尝试设置
this.viewer.infoBox.viewModel.description
,但这也无济于事。
解决方案
显然,这是由于在地图容器设置为 时选择了实体造成的display: none
。我可以通过延迟执行直到焦点返回地图来解决这个问题。
推荐阅读
- java - JavaFX 透明 GIF 闪烁
- vb.net - vb.net 使用 Eircode 调用 google api 以获取完整地址
- android - 为android构建电报时出现cmake错误
- angular - 类型'可观察的
' 不可分配给类型 'Observable ' - javascript - 在 Stripe Nodejs 上创建会话付款确认
- python - 在 tkinter 树视图上显示全文
- kotlin - 单独的 Dispatchers.IO 块中的不适当的阻塞方法调用警告
- android - 在 Android 构建上使用 windows 包
- javascript - 当 Emoji 具有肤色时,Javascript 会遍历 Unicode
- vbscript - HTA,VBScript settimeout,更新元素不起作用