Cesium 默认双击trackedEntity事件取消

1 背景

Cesium默认通过双击事件trackedEntity,但实际上有些时候并不需要。

2 解决方案

2.1 方法1

Remove the original event handler from the Cesium Widget ScreenSpaceEventHandler

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

2.2 方法2

Another, probably less intrusive way, is to add an additional event handler to our own ScreenSpaceEventHandler, which will set the Viewer’s trackedEntity to undefined:

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function(movement) {
    
    
    viewer.trackedEntity = undefined;
}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);

Guess you like

Origin blog.csdn.net/Tmraz/article/details/118809163