Cesium allows us to easily zoom and track an entity, by double clicking on that entity.
But sometimes you wouldn’t necessarily want that behavior, as double clicking is a very common UI ability.
There are 2 easy ways to remove/disable this default behavior:
- Remove the original event handler from the Cesium Widget ScreenSpaceEventHandler:
viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
- Another, probably less intrusive way, is to add an additional event handler to our own ScreenSpaceEventHandler, which will set the Viewer’s trackedEntity to undefined:
var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); handler.setInputAction(function(movement) { viewer.trackedEntity = undefined; }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
Thanks!