// @ts-nocheck export class mapLinkage { private leftViewer: Cesium.Viewer; private rightViewer: Cesium.Viewer; private MOUSE_TYPE: { LEFT: number; RIGHT: number } = { LEFT: 0, RIGHT: 1 }; private windowMouseType: number = this.MOUSE_TYPE.LEFT; constructor(private leftViewerId: string, private rightViewerId: string) { this.init(); } private init(): void { this.leftViewer = new Cesium.Viewer(this.leftViewerId, { sceneModePicker: false, infoBox: false, shouldAnimate: true, timeline: false, animation: false, }); this.rightViewer = new Cesium.Viewer(this.rightViewerId, { sceneMode: Cesium.SceneMode.SCENE2D, sceneModePicker: false, infoBox: false, shouldAnimate: true, timeline: false, animation: false, }); const leftHandler = new Cesium.ScreenSpaceEventHandler(this.leftViewer.canvas); leftHandler.setInputAction(() => { this.windowMouseType = this.MOUSE_TYPE.LEFT; }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); this.leftViewer.scene.postRender.addEventListener(() => { if (this.windowMouseType === this.MOUSE_TYPE.RIGHT) return; const destination = Cesium.Cartographic.toCartesian(this.leftViewer.camera.positionCartographic); this.rightViewer.camera.setView({ destination: new Cesium.Cartesian3(destination.x, destination.y, destination.z), }); }); const rightHandler = new Cesium.ScreenSpaceEventHandler(this.rightViewer.canvas); rightHandler.setInputAction(() => { this.windowMouseType = this.MOUSE_TYPE.RIGHT; }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); this.rightViewer.scene.postRender.addEventListener(() => { if (this.windowMouseType === this.MOUSE_TYPE.LEFT) return; const destination = Cesium.Cartographic.toCartesian(this.rightViewer.camera.positionCartographic); this.leftViewer.camera.setView({ destination: new Cesium.Cartesian3(destination.x, destination.y, destination.z), orientation: { heading: this.leftViewer.camera.heading, pitch: this.leftViewer.camera.pitch, roll: this.leftViewer.camera.roll, }, }); }); } }