How can I copy the new camera view (after user drag)?

How can I copy the new camera view after the user mouse mover to a new position?

I have the following code. It currently still retain the original camera view information.

function setview(){
var camera = viewer.camera;
cameraProperties = {
position: camera.position.clone(),
direction: camera.direction.clone(),
up: camera.up.clone(),
right: camera.right.clone(),
transform: camera.transform.clone(),
frustum: camera.frustum.clone()
};

}

The position, direction and up should be sufficient to capture the camera view. This is my go to snippet for saving camera views: How to share custom Sandcastle examples.

Instead of viewer.camera.flyTo you can also use viewer.camera.setView like in this example: https://sandcastle.cesium.com/index.html?src=3D%20Tiles%20Feature%20Picking.html

// Set the initial camera view to look at Manhattan
var initialPosition = Cesium.Cartesian3.fromDegrees(
  -74.01881302800248,
  40.69114333714821,
  753
);
var initialOrientation = new Cesium.HeadingPitchRoll.fromDegrees(
  21.27879878293835,
  -21.34390550872461,
  0.0716951918898415
);
viewer.scene.camera.setView({
  destination: initialPosition,
  orientation: initialOrientation,
  endTransform: Cesium.Matrix4.IDENTITY,
});