document.querySelector('.rotation1').addEventListener("click", () => {
document.querySelector('.rotation2').addEventListener("click", () => {
function rotationCamera(n) {
let centerScreen = getScreenCenterCoordinates();
console.log(centerScreen, 'getScreenCenterCoordinates');
const camera = viewer.camera;
let p = Cartesian3_to_WGS84(camera.position)
var point1 = turf.point(centerScreen);
var point2 = turf.point(p);
var options = { units: 'meters' };
var bearing = turf.bearing(point1, point2);
var bearing1 = turf.bearing(point2, point1);
console.log(bearing, bearing1, 'bearing1bearing1');
var distance = turf.distance(point1, point2, options);
let newBearing = bearing + n;
console.log(newBearing, 'newBearing');
var destination = turf.destination(point1, distance, newBearing, options);
let newP = destination.geometry.coordinates
bearingCamera = newBearing - 180
bearingCamera = newBearing + 180
destination: Cesium.Cartesian3.fromDegrees(newP[0], newP[1], newP[2]),
heading: Cesium.Math.toRadians(bearingCamera),
function getScreenCenterCoordinates() {
var scene = viewer.scene;
var canvas = scene.canvas;
var center = new Cesium.Cartesian2(canvas.clientWidth / 2, canvas.clientHeight / 2);
var ellipsoid = scene.globe.ellipsoid;
var centerPosition = scene.camera.pickEllipsoid(center, ellipsoid);
var centerCartographic = Cesium.Cartographic.fromCartesian(centerPosition);
var centerLongitude = Cesium.Math.toDegrees(centerCartographic.longitude);
var centerLatitude = Cesium.Math.toDegrees(centerCartographic.latitude);
let height = (viewer.camera.positionCartographic.height).toFixed(2);
let coordinates = [centerLongitude, centerLatitude, height];
function Cartesian3_to_WGS84(point) {
var cartesian3 = new Cesium.Cartesian3(point.x, point.y, point.z);
var cartographic = Cesium.Cartographic.fromCartesian(cartesian3);
var lat = Cesium.Math.toDegrees(cartographic.latitude);
var lng = Cesium.Math.toDegrees(cartographic.longitude);
var alt = cartographic.height.toFixed(2);