function calculateDimensionLeftTopEdge(
  overflowAreaPositionFixer,
  { left, top, width, height, cropX, cropY }
) {
  const dimension = {
    width,
    height,
  };

  forEach(['x', 'y'], (type) => {
    const cropDistance = type === 'x' ? cropX : cropY;
    const compareSize = dimension[POSITION_DIMENSION_MAP[type]];
    const standardSize = cachedCanvasImageElement[POSITION_DIMENSION_MAP[type]];

    if (compareSize > standardSize) {
      const outDistance = (compareSize - standardSize) / 2;

      dimension[POSITION_DIMENSION_MAP[type]] = standardSize;
      [left, top] = overflowAreaPositionFixer(type, outDistance, left, top);
    }
    if (cropDistance < 0) {
      [left, top] = overflowAreaPositionFixer(type, cropDistance, left, top);
    }
  });

  return [left, top, dimension.width, dimension.height];
}
Calculate fill image position and size for for left top
@param {Function} overflowAreaPositionFixer - position fixer
@param {Object} options - options for position dimension calculate
  @param {fabric.Object} shapeObj - shape object
  @param {number} left - original left position
  @param {number} top - original top position
  @param {number} width - image width
  @param {number} height - image height
  @param {number} cropX - image cropX
  @param {number} cropY - image cropY
@returns {Object}