code: function (width, height) {
                  /** @type {?} */
                  var ratio = width / height;
                  /** @type {?} */
                  var maxWidth = this.screenDimensions.width > this.maxPreviewWidth ?
                      this.maxPreviewWidth : this.screenDimensions.width - 40;
                  /** @type {?} */
                  var maxHeight = this.screenDimensions.height - 240;
                  /** @type {?} */
                  var calculated = {
                      width: maxWidth,
                      height: Math.round(maxWidth / ratio),
                      ratio: ratio
                  };
                  if (calculated.height > maxHeight) {
                      calculated.height = maxHeight;
                      calculated.width = Math.round(maxHeight * ratio);
                  }
                  return calculated;
              }
docs: calculate dimensions of the preview canvas
  @private
  @param {?} width
  @param {?} height
  @return {?}