https://blog.csdn.net/Albert_Ejiestein/article/details/89045105
一些参考,不过有可能要降低版本
// 鼠标左击事件
handler.setInputAction(function onLeftClick(movement) {
if (!picking) return;
const pickedFeature = viewer.scene.pick(movement.position);
if (Cesium.defined(pickedFeature) &&
pickedFeature instanceof Cesium.Cesium3DTileFeature &&
pickedFeature.tileset === tileset) {
console.log(pickedFeature.id);
const dbId = getFeatureDbId(pickedFeature);
if (dbId === selectedDbId) {
clearSelected();
} else {
setSelected(dbId);
}
} else {
clearSelected();
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
// 鼠标右击事件-弹出菜单列表
handler.setInputAction(function onRightClick(movement) {
if (!picking) return;
console.log(movement.position);
const pickedFeature = viewer.scene.pick(movement.position);
// 3dtiles右击
if (Cesium.defined(pickedFeature) &&
pickedFeature instanceof Cesium.Cesium3DTileFeature &&
pickedFeature.tileset === tileset) {
const dbId = getFeatureDbId(pickedFeature);
var cartesian = labelEntity.cartesian;
if (Cesium.defined(cartesian)) {
menuCartesian = cartesian;
$("#menuList").css("display", "block");
$("#menuList").css("left", movement.position.x);
$("#menuList").css("top", movement.position.y);
}
}
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);