code: function() {
      return function limitLetterbox(params) {
        if(params.width <= 0 || params.height <= 0) {
          return params;
        }
        var viewportAspectRatio = params.width / params.height;
  
        var fullWidthZoom = 1.0;
        var fullHeightZoom = viewportAspectRatio / params.mediaAspectRatio;
  
        // If the image is wider than the viewport, limit the horizontal zoom to
        // the image width.
        if (params.mediaAspectRatio >= viewportAspectRatio) {
          params.zoom = Math.min(params.zoom, fullWidthZoom);
        }
  
        // If the image is narrower than the viewport, limit the vertical zoom to
        // the image height.
        if (params.mediaAspectRatio <= viewportAspectRatio) {
          params.zoom = Math.min(params.zoom, fullHeightZoom);
        }
  
        // If the full image width is visible, limit x to the central point.
        // Else, bound x such that image is visible up to the horizontal edges.
        var minX, maxX;
        if (params.zoom > fullWidthZoom) {
          minX = maxX = 0.5;
        } else {
          minX = 0.0 + 0.5 * params.zoom / fullWidthZoom;
          maxX = 1.0 - 0.5 * params.zoom / fullWidthZoom;
        }
  
        // If the full image height is visible, limit y to the central point.
        // Else, bound y such that image is visible up to the vertical edges.
        var minY, maxY;
        if (params.zoom > fullHeightZoom) {
          minY = maxY = 0.5;
        } else {
          minY = 0.0 + 0.5 * params.zoom / fullHeightZoom;
          maxY = 1.0 - 0.5 * params.zoom / fullHeightZoom;
        }
  
        // Clamp x and y into the calculated bounds.
        params.x = clamp(params.x, minX, maxX);
        params.y = clamp(params.y, minY, maxY);
  
        return params;
      };
    }
docs: Returns a view limiter that constrains the zoom parameter such that
  zooming out is prevented beyond the point at which the image is fully
  visible. Unless the image and the viewport have the same aspect ratio,
  this will cause bands to appear around the image.
  @return {FlatViewLimiter}