Hello everyone, since I have very large data, I wrote the code below to show only the marks where the camera points. However, momentary freezes occur. How can I follow the solution?
export const getBoundingBox = (viewer: Viewer) => {
const rectangle = viewer.camera.computeViewRectangle();
if (rectangle) {
return {
west: CesiumMath.toDegrees(rectangle.west),
south: CesiumMath.toDegrees(rectangle.south),
east: CesiumMath.toDegrees(rectangle.east),
north: CesiumMath.toDegrees(rectangle.north),
};
}
return null;
};
cesiumViewer.current?.camera.moveEnd.addEventListener(() => {
const initialBbox = getBoundingBox(cesiumViewer.current!);
setBbox(initialBbox);
const updatedBbox = getBoundingBox(cesiumViewer.current!);
setBbox(updatedBbox);
});