I am trying to implement the default infobox implementation into my system. For reference, I’m using cesium with Reactjs, so some of my code may look different than the regular embedded cesium js examples I see on here.
The infobox seems to work as expected, if I click on an entity, it pulls up the description from that entity. The issue arises when I click on an empty part of the globe. I expect to get no infobox, but instead I’m getting something like this:
This is where I have initialized the viewer. the only real change is that infobox is set to true, and some attributes are set to it to allow for the content we need in the infobox.
componentDidMount() {
this.viewer = new Viewer(this.cesiumContainer, {
animation: false,
fullscreenButton: true,
geocoder: false,
infoBox: true,
screenModePicker: false,
sceneModePicker: false,
selectionIndicator: false,
timeline: false,
homeButton: true,
navigationHelpButton: true,
navigationInstructionsInitiallyVisible: false,
imageryProviderViewModels: null,
clockViewModel: null,
baseLayerPicker: false,
skyAtmosphere: false,
imageryProvider: new ArcGisMapServerImageryProvider({
url:
“https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer”
})
});
this.viewer.infoBox.frame.setAttribute(
“sandbox”,
“allow-same-origin allow-scripts allow-popups allow-forms”
);
this.viewer.infoBox.frame.removeAttribute(“sandbox”);
this.viewer.scene.globe.showGroundAtmosphere = false;
//Non-readonly properties can be altered after initialization, lowered resolution for performance
this.viewer.resolutionScale = 1;
//Globe Options from redux
this.setGridVisibility(this.props.grid);
this.setSunVisibility(this.props.sun);
this.setAtmosphereVisibility(this.props.atm);
this.setStatusBarVisibility(this.props.statusBar);
//Selection a point on the globe for target
this.setGlobePointSelectionListener(
this.props.isSelectingTargets || this.props.isSelectingBoundingBox !== “”
);
}
``
I would expect the default infobox behavior since I haven’t made any modifications to it other than enabling it when the viewer is created.
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I simply need the infobox to show up for our entities on the globe and nothing else. Hopefully that is straightforward enough.
4. The Cesium version you’re using, your operating system and browser.
Our setup is a bit strange:
cesium (via npm) 1.62.0
craco-cesium 1.1.1 (for React support)
Chrome Version 78.0.3904.108 (Official Build) (64-bit)