Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event for trackedEntity changes. #5060

Merged
merged 3 commits into from
Mar 2, 2017
Merged

Conversation

emackey
Copy link
Contributor

@emackey emackey commented Mar 1, 2017

This PR consists of 99.5% recycled code lines from @hpinkos selectedEntityChanged event in #5043.

@emackey
Copy link
Contributor Author

emackey commented Mar 1, 2017

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

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

viewer.selectedEntityChanged.addEventListener(function(entity) {
    if (entity !== undefined) {
         console.log('selected ' + entity.id);
    } else {
         console.log('de-selected.');
    }
});

viewer.trackedEntityChanged.addEventListener(function(entity) {
    if (entity !== undefined) {
         console.log('tracked ' + entity.id);
    } else {
         console.log('Stopped tracking.');
    }
});

@hpinkos
Copy link
Contributor

hpinkos commented Mar 2, 2017

Looks great, thanks @emackey!

@hpinkos hpinkos merged commit 06d23f1 into master Mar 2, 2017
@hpinkos hpinkos deleted the trackedEntityChangedEvent branch March 2, 2017 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants