function getViewportClampedResolution(
  resolution,
  maxExtent,
  viewportSize,
  showFullExtent,
) {
  const xResolution = getWidth(maxExtent) / viewportSize[0];
  const yResolution = getHeight(maxExtent) / viewportSize[1];

  if (showFullExtent) {
    return Math.min(resolution, Math.max(xResolution, yResolution));
  }
  return Math.min(resolution, Math.min(xResolution, yResolution));
}
Returns a modified resolution taking into account the viewport size and maximum
allowed extent.
@param {number} resolution Resolution
@param {import("./extent.js").Extent} maxExtent Maximum allowed extent.
@param {import("./size.js").Size} viewportSize Viewport size.
@param {boolean} showFullExtent Whether to show the full extent.
@return {number} Capped resolution.