viewerEntityMixin Question

How do you break the lock on an item once it has been selected. I know that I can click off of it and stop it from following that object but that I can't rotate the globe anymore. Everything is fixated around the area that things are occurring. I can tilt and zoom fine, but I can't rotate the globe. Is there a special key combo to re-enable this or something I can do programmatically?

You can do it programmatically by setting

viewer.trackedEntity = undefined;


You could call this with your own key event or button. I don’t think there’s anything built into Cesium to handle this. Also they’re going to be deprecating the viewerEntityMixin on the next release and move all its functionality into the viewer widget itself. Just a heads up if you didn’t know.

Hey Chris. I've already tried this... it doesn't work. I'm still locked on my czmldatasource. =( Any other ideas? THanks! =)


Sorry, I missed this post the first time around. To put the camera back to default behavior, you need to set the camera transform after undefined. I think this is probably the desired default behavior so I’m going to open a PR to do this.

viewer.trackedEntity = undefined;;

I just opened a PR to make this trivial and also doable from the default Viewer UI:

Hey Matthew!

Thanks for the reply. I tried this out just now. It did stop making the camera revolving around the tracks... but it doesn't stop the camera form revolving around the "offset" of where the track was. So my camera is now revolving around not the globe, but the North Pole of it. Is there a way i can reset it to revolve around the center of the globe instead of the top-tip of it?


If not, is there a way to disable the tracking overall? I would actually prefer that. =) I do not want to shut off viewerEntityMixin though. The "green selection" icon that wraps around the selected czmldatasource upon click is necessary. I just want to disable it from tracking.


Disabling tracking completely is easy.

  1. Disable double-click to track:


  1. Turn off InfoBox track button. Put this anywhere in your CSS after the widgets.css loads.

button.cesium-infoBox-camera {

display: none;


For completeness, here’s the answer to your first question:

It’s working as intended in that it keeps the current view but restores non-tracking camera behavior. There’s no good way for us to make it go back to looking at the center of the earth (especially since that’s not what a lot of people would want). You can set the camera to do that yourself or just fly to home using viewer.homeButton.viewModel.command();. If you fly to home, you don’t even need to undefined trackedEntity or set the transform, as flying home does that for you.

Thanks Matthew. You're my hero! >=)


Matthew, if possible, can you clarify it a bit further for me regarding on how to disable the double click on czmlDataSource? I tired the line you pasted... but that didn't work, so I tried to stop it from running further by doing the following, but it didn't work as well:

var mouseHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
      function (movement){
        var pickedObject = scene.pick(movement.position);
                if (Cesium.defined(pickedObject)) {

Again, thanks for the advice and guidance.

Sorry, there was a copy/paste error in my code. It should have been:


I pasted this at the bottom of and it works as expected.


Thank you. I spent several days trying to figure this out. I'm really relieved. For anyone who ever wonder about this as well, please remember to add:


right after:


For some reason, when I added it on the bottom of the page, it didn't work. =) Maybe because my code does something that affects the change...

One final FYI, with the latest version of Cesium, there’s no reason to call “viewer.extend(Cesium.viewerEntityMixin);” Viewer now includes the features from the mixin and the mixin will be going away in a future release (it’s currently an empty function).