Hi, im beginner with CesiumJs i want to Sychronize the view between 3D and 2D, my issue is, taht when i click on 3D, my 3D scene initialise which i dont want to happen and i dont know why, this is my setView and getView functions
public setView(view: View) {
var westSouth = view.extension.minimum;
var eastNorth = view.extension.maximum;
let destination = Rectangle.fromDegrees(
(westSouth.longitude),
(westSouth.latitude),
(eastNorth.longitude),
(eastNorth.latitude),
);
this.viewer.camera.setView({
destination: destination,
orientation: {
heading: view.camera.bearing * CesiumRenderer.degreesToRadians, // Heading is the rotation from the local north direction where a positive angle is increasing eastward
//pitch: view.camera.pitch * CesiumRenderer.degreesToRadians,
pitch: -Math.PI/2, //topdown -> the horizon
roll: undefined,
},
});
}
public getView(): View<Box> {
const heading = this.viewer.camera.heading * CesiumRenderer.radiansToDegrees;
const pitch = this.viewer.camera.pitch * CesiumRenderer.radiansToDegrees + 90;
const roll = this.viewer.camera.roll * CesiumRenderer.radiansToDegrees;
//TODO: calculate from heading, pitch, roll
const camera = new Camera(heading, pitch);//heading pitch
const viewRectangle = this.viewer.camera.computeViewRectangle();
const bBox = new Box(
[
viewRectangle.west * CesiumRenderer.radiansToDegrees,
viewRectangle.south * CesiumRenderer.radiansToDegrees,
],
[
viewRectangle.east * CesiumRenderer.radiansToDegrees,
viewRectangle.north * CesiumRenderer.radiansToDegrees,
],
);
return new View<Box>(bBox, camera);
}