src/views/Flat.js
function(min, max) {
    return function limitVisibleY(params) {

      // Do nothing for a null viewport.
      if (params.width <= 0 || params.height <= 0) {
        return params;
      }

      // Calculate the X to Y conversion factor.
      var viewportAspectRatio = params.width / params.height;
      var factor = viewportAspectRatio / params.mediaAspectRatio;

      // Calculate the zoom value that makes the specified range fully visible.
      var maxZoom = (max - min) * factor;

      // Clamp zoom to the maximum value.
      if (params.zoom > maxZoom) {
        params.zoom = maxZoom;
      }

      // Bound Y such that the image is visible up to the range edges.
      var minY = min + 0.5 * params.zoom / factor;
      var maxY = max - 0.5 * params.zoom / factor;
      params.y = clamp(params.y, minY, maxY);

      return params;
    };
  }
function(min, max) {
    return function limitVisibleY(params) {

      // Do nothing for a null viewport.
      if (params.width <= 0 || params.height <= 0) {
        return params;
      }

      // Calculate the X to Y conversion factor.
      var viewportAspectRatio = params.width / params.height;
      var factor = viewportAspectRatio / params.mediaAspectRatio;

      // Calculate the zoom value that makes the specified range fully visible.
      var maxZoom = (max - min) * factor;

      // Clamp zoom to the maximum value.
      if (params.zoom > maxZoom) {
        params.zoom = maxZoom;
      }

      // Bound Y such that the image is visible up to the range edges.
      var minY = min + 0.5 * params.zoom / factor;
      var maxY = max - 0.5 * params.zoom / factor;
      params.y = clamp(params.y, minY, maxY);

      return params;
    };
  }
function ( min , max ) { return function limitVisibleY ( params ) { // Do nothing for a null viewport. if ( params . width <= 0 || params . height <= 0 ) { return params ; } // Calculate the X to Y conversion factor. var viewportAspectRatio = params . width / params . height ; var factor = viewportAspectRatio / params . mediaAspectRatio ; // Calculate the zoom value that makes the specified range fully visible. var maxZoom = ( max - min ) * factor ; // Clamp zoom to the maximum value. if ( params . zoom > maxZoom ) { params . zoom = maxZoom ; } // Bound Y such that the image is visible up to the range edges. var minY = min + 0.5 * params . zoom / factor ; var maxY = max - 0.5 * params . zoom / factor ; params . y = clamp ( params . y , minY , maxY ) ; return params ; } ; }
Returns a view limiter that constrains the values of the y parameter that
are inside the viewport.
@param {number} min The minimum y value.
@param {number} max The maximum y value.
@return {FlatViewLimiter}
Returns a view limiter that constrains the values of the y parameter that are inside the viewport .