src/resize.js
function relativeRescale (enabledElement, oldCanvasWidth, oldCanvasHeight) {
  const scale = enabledElement.viewport.scale;
  const canvasWidth = enabledElement.canvas.width;
  const canvasHeight = enabledElement.canvas.height;
  const relWidthChange = canvasWidth / oldCanvasWidth;
  const relHeightChange = canvasHeight / oldCanvasHeight;
  const relChange = Math.sqrt(relWidthChange * relHeightChange);

  enabledElement.viewport.scale = relChange * scale;
}
function relativeRescale (enabledElement, oldCanvasWidth, oldCanvasHeight) {
  const scale = enabledElement.viewport.scale;
  const canvasWidth = enabledElement.canvas.width;
  const canvasHeight = enabledElement.canvas.height;
  const relWidthChange = canvasWidth / oldCanvasWidth;
  const relHeightChange = canvasHeight / oldCanvasHeight;
  const relChange = Math.sqrt(relWidthChange * relHeightChange);

  enabledElement.viewport.scale = relChange * scale;
}
function relativeRescale ( enabledElement , oldCanvasWidth , oldCanvasHeight ) { const scale = enabledElement . viewport . scale ; const canvasWidth = enabledElement . canvas . width ; const canvasHeight = enabledElement . canvas . height ; const relWidthChange = canvasWidth / oldCanvasWidth ; const relHeightChange = canvasHeight / oldCanvasHeight ; const relChange = Math . sqrt ( relWidthChange * relHeightChange ) ; enabledElement . viewport . scale = relChange * scale ; }
Rescale the image relative to the changed size of the canvas

@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 {void}
Rescale the image relative to the changed size of the canvas