cesium 地图 事件触发
var handler = new Cesium.ScreenSpaceEventHandler(window.viewer.scene.canvas);
handler.setInputAction((click) => {
console.log('左键单击事件:', click.position);
var ray = window.viewer.camera.getPickRay(click.position);
var position = window.viewer.scene.globe.pick(ray, window.viewer.scene);
if (position) {
console.log('位置信息position:', position);
console.log('位置信息:', Cesium.Cartographic.fromCartesian(position));
// var cartographicPositions = Cesium.Ellipsoid.WGS84.cartesianArrayToCartographicArray(position);
// console.log('WGS848经纬度信息:x , y , z ',cartographicPositions);
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
// handler.setInputAction(function(click){
// console.log('左键双击事件:',click.position);
// },Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
// handler.setInputAction(function(click){
// console.log('左键按下事件:',click.position);
// },Cesium.ScreenSpaceEventType.LEFT_DOWN);
// handler.setInputAction(function(click){
// console.log('左键弹起事件:',click.position);
// },Cesium.ScreenSpaceEventType.LEFT_UP);
// handler.setInputAction(function(click){
// console.log('中键按下事件:',click.position);
// },Cesium.ScreenSpaceEventType.MIDDLE_DOWN);
// handler.setInputAction(function(click){
// console.log('中键弹起事件:',click.position);
// },Cesium.ScreenSpaceEventType.MIDDLE_UP);
// handler.setInputAction(function(movement){
// console.log('移动事件:',movement.endPosition);
// },Cesium.ScreenSpaceEventType.MOUSE_MOVE);
// handler.setInputAction(function(click){
// console.log('右键单击事件',click.position);
// },Cesium.ScreenSpaceEventType.RIGHT_CLICK);
// handler.setInputAction(function(click){
// console.log('右键按下事件',click.position);
// },Cesium.ScreenSpaceEventType.RIGHT_DOWN);
// handler.setInputAction(function(click){
// console.log('右键弹起事件',click.position);
// },Cesium.ScreenSpaceEventType.RIGHT_UP);
// handler.setInputAction(function(wheelment){
// console.log('滚轮事件:',wheelment);
// },Cesium.ScreenSpaceEventType.WHEEL);
// handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);