function clampMove2D(camera, position) {
  const rotatable2D = camera._scene.mapMode2D === MapMode2D.ROTATE;
  const maxProjectedX = camera._maxCoord.x;
  const maxProjectedY = camera._maxCoord.y;

  let minX;
  let maxX;
  if (rotatable2D) {
    maxX = maxProjectedX;
    minX = -maxX;
  } else {
    maxX = position.x - maxProjectedX * 2.0;
    minX = position.x + maxProjectedX * 2.0;
  }

  if (position.x > maxProjectedX) {
    position.x = maxX;
  }
  if (position.x < -maxProjectedX) {
    position.x = minX;
  }

  if (position.y > maxProjectedY) {
    position.y = maxProjectedY;
  }
  if (position.y < -maxProjectedY) {
    position.y = -maxProjectedY;
  }
}
Transform a vector from the camera's reference frame to world coordinates.

@param {Cartesian3} cartesian The vector to transform.
@param {Cartesian3} [result] The object onto which to store the result.
@returns {Cartesian3} The transformed vector.