src/resize.js
function wasFitToWindow (enabledElement, oldCanvasWidth, oldCanvasHeight) {
  const scale = enabledElement.viewport.scale;
  const imageSize = getImageSize(enabledElement.image, enabledElement.viewport.rotation);
  const imageWidth = Math.round(imageSize.width * scale);
  const imageHeight = Math.round(imageSize.height * scale);
  const x = enabledElement.viewport.translation.x;
  const y = enabledElement.viewport.translation.y;

  return (imageWidth === oldCanvasWidth && imageHeight <= oldCanvasHeight) ||
    (imageWidth <= oldCanvasWidth && imageHeight === oldCanvasHeight) &&
    (x === 0 && y === 0);
}
function wasFitToWindow (enabledElement, oldCanvasWidth, oldCanvasHeight) {
  const scale = enabledElement.viewport.scale;
  const imageSize = getImageSize(enabledElement.image, enabledElement.viewport.rotation);
  const imageWidth = Math.round(imageSize.width * scale);
  const imageHeight = Math.round(imageSize.height * scale);
  const x = enabledElement.viewport.translation.x;
  const y = enabledElement.viewport.translation.y;

  return (imageWidth === oldCanvasWidth && imageHeight <= oldCanvasHeight) ||
    (imageWidth <= oldCanvasWidth && imageHeight === oldCanvasHeight) &&
    (x === 0 && y === 0);
}
function wasFitToWindow ( enabledElement , oldCanvasWidth , oldCanvasHeight ) { const scale = enabledElement . viewport . scale ; const imageSize = getImageSize ( enabledElement . image , enabledElement . viewport . rotation ) ; const imageWidth = Math . round ( imageSize . width * scale ) ; const imageHeight = Math . round ( imageSize . height * scale ) ; const x = enabledElement . viewport . translation . x ; const y = enabledElement . viewport . translation . y ; return ( imageWidth === oldCanvasWidth && imageHeight <= oldCanvasHeight ) || ( imageWidth <= oldCanvasWidth && imageHeight === oldCanvasHeight ) && ( x === 0 && y === 0 ) ; }
Checks if the image of a given enabled element fitted the window
before the resize

@param {EnabledElement} enabledElement The Cornerstone Enabled Element
@param {number} oldCanvasWidth The width of the canvas before the resize
@param {number} oldCanvasHeight The height of the canvas before the resize
@return {Boolean} true if it fitted the windows, false otherwise
Checks if the image of a given enabled element fitted the window before the resize