cesium怎么清除handler&刪除所有實體


一、

2、取消左鍵雙擊事件

viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);

參考1:https://blog.csdn.net/weixin_40184249/article/details/91404371

二、

removeEventHandler

// 別名,但不建議使用。
this.addEventListener = this.on;
this.removeEventListener = this.clearAllEventListeners = this.off;

 

cesium removeeventlistener函數

cesium綁定鼠標事件,及清除事件(采坑清除事件不起作用,解決方案):https://blog.csdn.net/weixin_44058725/article/details/105856045

事件:

Cesium.ScreenSpaceEventType.MOUSE_MOVE:鼠標移動
Cesium.ScreenSpaceEventType.LEFT_CLICK:鼠標左鍵點擊
Cesium.ScreenSpaceEventType.WHEEL:滾輪縮放
 
>>>清除實體
Cesium知識點(一):實體對象的添加、獲取、刪除: https://www.codeleading.com/article/66461176977/
Cesium區分單擊【LEFT_CLICK】和雙擊事件【LEFT_DOUBLE_CLICK】:https://www.cnblogs.com/aizai846/p/11315891.html   https://blog.csdn.net/qq_18144905/article/details/82178132
 
監聽滾輪
   //設置鼠標滾動事件的處理函數,這里負責監聽高度值變化
    this.handler.setInputAction(function(wheelment) {
        height = Math.ceil(viewer.camera.positionCartographic.height);
        entity.position = cartesian;
        entity.label.show = true;
        entity.label.text = '(' + longitudeString + ', ' + latitudeString + "," + height + ')' ;
        entity.label.fillColor = Cesium.Color.BLACK;
    }, Cesium.ScreenSpaceEventType.WHEEL);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM