1. A concise explanation of the problem you're experiencing.
Hi -- I have a java script that plots some data points on Cesium.
If I right click on a data point I get a popup alert window that displays information on that data point. When I close the window it closes and then relaunches. It will probably do this over 50 times before it stops.
I modeled my code off of some example code.
The example code does not have this type of behavior.
I'm wondering what is wrong in the Cesium.ScreenSpaceEventHandler code that I am using.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
Here is the code for the Cesium.ScreenSpaceEventHandler.
var scene = viewer.scene;
var canvas = viewer.canvas;
var handler = new Cesium.ScreenSpaceEventHandler(canvas);
handler.setInputAction(function(click) {
console.log("In Handler for click event");
var alertText = '';
function addToMessage(key, value) {
alertText += key + ': ' + value + '\n';
}
var pickedObject = scene.pick(click.position);
console.log(pickedObject);
console.log(pickedObject.id._id);
console.log(Cesium.defined(pickedObject));
console.log(pickedObject.id == entity);
if (Cesium.defined(pickedObject)) {
addToMessage(pickedObject.id.description);
var position = viewer.camera.pickEllipsoid(click.position);
var cartographicPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);
terrainSamplePositions = [cartographicPosition];
Cesium.sampleTerrain(viewer.terrainProvider, 9,terrainSamplePositions).then(function() {
}).always(function() {
alert(pickedObject.id.description);
});
handler.destroy();
}
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I want to be able to show information about the data poits displayed in Cesium.
4. The Cesium version you're using, your operating system and browser.
Cesium Version 1.36
OS Windows 7 Enterprise
Browser Internet Explorer 11