Cesiumjs – How to add global event for specific entities?

phpmind-cesiumjs-event-for-specific-entities

 var viewer = new Cesium.Viewer('cesiumContainer');

    viewer.dataSources.add(Cesium.CzmlDataSource.load('../../SampleData/simple.czml'));

    Cesium.knockout.getObservable(viewer, '_selectedEntity').subscribe(function(entity) {
        if (!Cesium.defined(entity)) {
            console.log('De-selected entity.');
        } else {
            console.log('Selected entity ' + (entity.name || entity.id));
        }
    });
Share

Leave a Reply

Your email address will not be published. Required fields are marked *