var handler1 = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
if (flag) {
console.log(666)
var h = viewer.camera.positionCartographic.height;
if (h > 21000) {
this.ac("本区域存在滑动沉降", true, 800);
} else if (h < 2400 && h > 0) {
this.ac("昭通市昭阳区靖安镇小堡子村,距离道路中心线(线位ZK1+460~ZK1+650)约100m,位于道路边坡外:-10~-30 mm/year", false, 0);
} else {
this.ac("本区域存在滑动沉降", true, 100);
}
//监控相机高度
handler1.setInputAction(function (wheelment) {
console.log(wheelment)
var height = viewer.camera.positionCartographic.height;
console.log(height, "5555")
if (height > 21000) {
_this.ac("", true, 800);
} else if (height < 2400 && height > 0) {
_this.ac("昭通市昭阳区靖安镇小堡子村,距离道路中心线(线位ZK1+460~ZK1+650)约100m,位于道路边坡外:-10~-30 mm/year", false, 0);
} else {
_this.ac("本区域存在滑动沉降", true, 100);
}
}, Cesium.ScreenSpaceEventType.WHEEL);
// console.log(handler1.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL),handler1)
//handler1.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL)
} else {
handler1.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL)
viewer.scene.postProcessStages.removeAll();
viewer.entities.removeAll();
}
这个我判断走else清楚滑轮监听高度事件,不起作用是为什么?