var currentEntity = null;
var lastEntity = null;
viewer.screenSpaceEventHandler.setInputAction(function onMouseMove(movement) {
var pickedFeature = viewer.scene.pick(movement.endPosition);
if (lastEntity!=null && lastEntity.id != undefined) {
lastEntity.label.show=false;
}
if (Cesium.defined(pickedFeature)) {
if(pickedFeature.id != undefined){
currentEntity = viewer.entities.getById(pickedFeature.id._id);
lastEntity = currentEntity;
currentEntity.label.show=true;
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
项目需要显示悬浮点位label,但是在ScreenSpaceEventType事件类型中并未集成MOUSE_OVER,根据MOUSE_MOVE获取到最后的位置,scene.pick(position)获取当前位置的实体进行操作