XbsjEarthUI icon indicating copy to clipboard operation
XbsjEarthUI copied to clipboard

请问earthsdk的双击旋转功能可以自定义一下吗?

Open vtxf opened this issue 4 years ago • 0 comments

请问earthsdk的双击旋转功能可以自定义一下吗? 请问双击旋转可以写死中心点和半径吗


flyAround

可以使用earth.camera.flyAround来操作。 image
比如这样:
earth.camera.flyAround([2.1206125026580582,0.545178729438238,15], 3000, [0, -Math.PI / 5, 0], 0, 3.14/50);

示例

效果参见数字城市示例:http://earthsdk.com/v/last/Apps/Examples/earth-digitalCity.html

取消操作

如果需要取消默认的双击旋转事件,可以使用这个方法 earth.czm.viewer.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);

左键双击自定义

添加新方法可以这样:

        earth.czm.viewer.screenSpaceEventHandler.setInputAction(event => {
            // 以下代码根据需要自行修改
            const pp = Cesium.xbsjPickPosition(viewer.scene, event.position, scratchCartesian);
            if (pp) {
                Cesium.xbsjFlyAround(viewer.camera, pp);
            }
        }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);

vtxf avatar Nov 20 '19 03:11 vtxf