viewer.screenSpaceEventHandler.setInputAction(function onm ouseMove(
movement
) {
// If a feature was previously highlighted, undo the highlight
if (Cesium.defined(highlighted.feature)) {
highlighted.feature.color = highlighted.originalColor;
highlighted.feature = undefined;
}
// Pick a new feature
var pickedFeature = viewer.scene.pick(movement.endPosition);
if (!Cesium.defined(pickedFeature)) {
return;
}
// Highlight the feature
highlighted.feature = pickedFeature;
Cesium.Color.clone(pickedFeature.color, highlighted.originalColor);
pickedFeature.color = Cesium.Color.YELLOW;
},
Cesium.ScreenSpaceEventType.MOUSE_MOVE);
本文转自 https://my.oschina.net/u/4290521/blog/4553405,如有侵权,请联系删除。