computed: { handler() { return new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas) } }
// Get latitude and longitude of the method the getPosition () { const _this = the this // this must be converted in about setInputAction method, this points to changes _this.handler.setInputAction ( function (Movement) { // Get the screen coordinate var position = movement.endPosition // screen coordinates into world coordinates var Pick = new new _this.Cesium.Cartesian2 (position.x, position.y) var of Cartesian = _this.viewer.scene.globe.pick (_this.viewer.camera.getPickRay (Pick), _this.viewer.scene) // world coordinates to latitude and longitude var ellipsoid = _this.viewer.scene.globe.ellipsoid IF(cartesian === undefined){ }else{ var cartesian3 = new _this.Cesium.Cartesian3(cartesian.x, cartesian.y, cartesian.z) var cartographic = ellipsoid.cartesianToCartographic(cartesian3) var lat = _this.Cesium.Math.toDegrees(cartographic.latitude) //这是纬度 var lng = _this.Cesium.Math.toDegrees(cartographic.longitude) //这是经度 _this.latitudeData = lat _this.longitudeData = lng } }, _This.Cesium.ScreenSpaceEventType.MOUSE_MOVE) //_this.Cesium in main.js well equipped with global variables }